diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-02-21 21:01:48 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-02-21 21:01:48 +0000 |
commit | d90053d50ea848462558d036225968cdf6c02dde (patch) | |
tree | 45be9914d7fefebe40b0ee1ea834fe2521f0854d /app | |
parent | 7ff0c8ae57e6a88c86afae4f8e08bfacfb34d761 (diff) | |
parent | 0a11d5e24559d9e22a3e9ab7311646f762a13562 (diff) | |
download | gitlab-ce-d90053d50ea848462558d036225968cdf6c02dde.tar.gz |
Merge branch 'dz-sort-labels-alphabetically' into 'master'
Sort labels alphabetically on issues and merge requests list
Closes #57003
See merge request gitlab-org/gitlab-ce!25470
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/labels_helper.rb | 4 | ||||
-rw-r--r-- | app/views/projects/issues/_issue.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/merge_requests/_merge_request.html.haml | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index 39f661b5f0c..bd53add80ca 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -227,6 +227,10 @@ module LabelsHelper "#{action} at #{level} level" end + def labels_sorted_by_title(labels) + labels.sort_by(&:title) + end + # Required for Banzai::Filter::LabelReferenceFilter module_function :render_colored_label, :text_color_for_bg, :escape_once end diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index 31c72f2f759..ce7c7091c93 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -36,7 +36,7 @@ = issue.due_date.to_s(:medium) - if issue.labels.any? - - issue.labels.each do |label| + - labels_sorted_by_title(issue.labels).each do |label| = link_to_label(label, subject: issue.project, css_class: 'label-link') .issuable-meta diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index ac29cd8f679..90916191d97 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -34,7 +34,7 @@ = merge_request.target_branch - if merge_request.labels.any? - - merge_request.labels.each do |label| + - labels_sorted_by_title(merge_request.labels).each do |label| = link_to_label(label, subject: merge_request.project, type: :merge_request, css_class: 'label-link') .issuable-meta |