diff options
author | Go MAEDA <maeda@farend.jp> | 2020-12-25 02:25:41 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-12-25 02:25:41 +0000 |
commit | 30e80d82ce189b4232e143b054f78870afd076da (patch) | |
tree | 5fe7e869f72af34cf6af07e1e0e1d5cadbdbdd99 /app/helpers | |
parent | d11f8edc2d87ae1c0db8cbdfb0dd101d9cb5c645 (diff) | |
download | redmine-30e80d82ce189b4232e143b054f78870afd076da.tar.gz redmine-30e80d82ce189b4232e143b054f78870afd076da.zip |
Bulk addition of related issues (#33418).
Patch by Dmitry Makurin and Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@20689 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/issue_relations_helper.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/helpers/issue_relations_helper.rb b/app/helpers/issue_relations_helper.rb index 9c5d2123b..a1ddad824 100644 --- a/app/helpers/issue_relations_helper.rb +++ b/app/helpers/issue_relations_helper.rb @@ -22,4 +22,23 @@ module IssueRelationsHelper values = IssueRelation::TYPES values.keys.sort_by{|k| values[k][:order]}.collect{|k| [l(values[k][:name]), k]} end + + def relation_error_messages(relations) + messages = {} + relations.each do |item| + item.errors.full_messages.each do |message| + messages[message] ||= [] + messages[message] << item + end + end + + messages.map do |message, items| + ids = items.map(&:issue_to_id).compact + if ids.empty? + message + else + "#{message}: ##{ids.join(', ')}" + end + end + end end |