summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-02-07 09:39:39 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-02-07 09:39:39 +0000
commit3519083dbe4be46f236a0c2b224fd43d29873c33 (patch)
tree7f178c71deb89787c45933e8480034fd04ea009f /app/helpers
parent4bbd3d81fd5f8860703aa9a29bb6166a334cc6cc (diff)
downloadredmine-3519083dbe4be46f236a0c2b224fd43d29873c33.tar.gz
redmine-3519083dbe4be46f236a0c2b224fd43d29873c33.zip
Extract grouping logic to an helper.
git-svn-id: http://svn.redmine.org/redmine/trunk@13972 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/issues_helper.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index f974914ac..bfe3ae75a 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -32,6 +32,24 @@ module IssuesHelper
end
end
+ def grouped_issue_list(issues, query, issue_count_by_group, &block)
+ previous_group, first = false, true
+ issue_list(issues) do |issue, level|
+ group_name = group_count = nil
+ if query.grouped? && ((group = query.group_by_column.value(issue)) != previous_group || first)
+ if group.blank? && group != false
+ group_name = l(:label_none)
+ else
+ group_name = column_content(query.group_by_column, issue)
+ end
+ group_name ||= ""
+ group_count = issue_count_by_group[group]
+ end
+ yield issue, level, group_name, group_count
+ previous_group, first = group, false
+ end
+ end
+
# Renders a HTML/CSS tooltip
#
# To use, a trigger div is needed. This is a div with the class of "tooltip"