Skip to content

Commit

Permalink
Made the error message when a unique field is required
Browse files Browse the repository at this point in the history
more explicit about why the unique field is needed.
Also, made it localized!  Yikes.
  • Loading branch information
Leo Hourvitz committed Jun 24, 2011
1 parent c926fa0 commit 7743d05
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
20 changes: 13 additions & 7 deletions app/controllers/importer_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 141,21 @@ def result
attrs_map = fields_map.invert

# check params
unique_required = update_issue || attrs_map["parent_issue"] != nil
IssueRelation::TYPES.each_key do |rtype|
if attrs_map[rtype]
unique_required = true
break
unique_error = nil
if update_issue
unique_error = l(:text_rmi_specify_unique_field_for_update)
elsif attrs_map["parent_issue"] != nil
unique_error = l(:text_rmi_specify_unique_field_for_column,:column => l(:field_parent_issue))
else
IssueRelation::TYPES.each_key do |rtype|
if attrs_map[rtype]
unique_error = l(:text_rmi_specify_unique_field_for_column,:column => l("label_#{rtype}".to_sym))
break
end
end
end
if unique_required && unique_attr == nil
flash[:error] = "Unique field must be specified"
if unique_error && unique_attr == nil
flash[:error] = unique_error
return
end

Expand Down
2 changes: 2 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 35,5 @@ de:
button_submit: "Abschicken"
button_save_rules_and_submit: "Abschicken und Abgleich-Regel speichern"

text_rmi_specify_unique_field_for_update: "Unique field must be specified because Update existing issues is on"
text_rmi_specify_unique_field_for_column: "Unique field must be specified because the column {{column}} needs to refer to other tasks"
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 34,7 @@ en:
button_upload: "Upload File"
button_submit: "Submit"
button_save_rules_and_submit: "Save match rules and submit"

text_rmi_specify_unique_field_for_update: "Unique field must be specified because Update existing issues is on"
text_rmi_specify_unique_field_for_column: "Unique field must be specified because the column {{column}} needs to refer to other tasks"

3 changes: 3 additions & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 35,6 @@ ja:
button_submit: "確認"
button_save_rules_and_submit: "マッチルールを保存して確認"

text_rmi_specify_unique_field_for_update: "存在があるチケットの更新を選択されたので一意な値がある欄を選択が必要です。"
text_rmi_specify_unique_field_for_column: "「{{column}}」という連携があるコラムをインポートしているので一意な値がある欄を選択が必要です。"

3 changes: 3 additions & 0 deletions config/locales/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 34,6 @@ zh:
button_upload: "上传文件"
button_submit: "提交"
button_save_rules_and_submit: "存储匹配规则后提交"

text_rmi_specify_unique_field_for_update: "Unique field must be specified because Update existing issues is on"
text_rmi_specify_unique_field_for_column: "Unique field must be specified because the column {{column}} needs to refer to other tasks"

0 comments on commit 7743d05

Please sign in to comment.