diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-11-17 17:01:28 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-11-17 17:01:28 +0100 |
commit | 0b540a0fadf172277639910023fcf8b713ad35aa (patch) | |
tree | 9efe6d84cebdca7bc31bcc0e6e2e3b7bdf2e3185 /app/helpers/labels_helper.rb | |
parent | 3d50b99d016af91c06a40f7a8bf4c298e241220a (diff) | |
parent | df0110ba81a86b3e066c8b703e1c26d6d05a75da (diff) | |
download | gitlab-ce-0b540a0fadf172277639910023fcf8b713ad35aa.tar.gz |
Merge branch 'master' into dirceu/gitlab-ce-new-merge-request-from-file-edit
Diffstat (limited to 'app/helpers/labels_helper.rb')
-rw-r--r-- | app/helpers/labels_helper.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index 66b18eea699..795fb439f25 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 = GlobalLabel.build_collection(labels) + 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 |