summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2015-10-16 21:29:47 +0000
committerRobert Speicher <robert@gitlab.com>2015-10-16 21:29:47 +0000
commitc856a7a5934fba13598be09507c2090888f57a39 (patch)
tree5c9721a78f912a15242ee5df3cf1e4393cc6c323 /app/helpers
parent292b9da54acd96b19979e36a3f82462a37460416 (diff)
parentd10e3c4498e11e97548b0212887a146d19d19ffd (diff)
downloadgitlab-ce-c856a7a5934fba13598be09507c2090888f57a39.tar.gz
Merge branch 'filter-label' into 'master'
Allow dashboard and group issues/MRs to be filtered by label See merge request !1591
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/labels_helper.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index 66b18eea699..ee04ace35d0 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -92,11 +92,19 @@ module LabelsHelper
end
end
- def project_labels_options(project)
- labels = project.labels.to_a
- labels.unshift(Label::None)
- labels.unshift(Label::Any)
- options_from_collection_for_select(labels, 'name', 'title', params[:label_name])
+ def projects_labels_options
+ labels =
+ if @project
+ @project.labels
+ else
+ Label.where(project_id: @projects)
+ end
+
+ grouped_labels = Labels::GroupService.new(labels).execute
+ grouped_labels.unshift(Label::None)
+ grouped_labels.unshift(Label::Any)
+
+ options_from_collection_for_select(grouped_labels, 'name', 'title', params[:label_name])
end
# Required for Gitlab::Markdown::LabelReferenceFilter