diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-02-21 19:06:14 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-02-21 23:19:24 +0300 |
commit | 0a11d5e24559d9e22a3e9ab7311646f762a13562 (patch) | |
tree | d737114f2140d04b9e44f71cbbf138a212b0eb35 /app | |
parent | c8bf9f78f3e481cb7e74384fa45b46b864fa523a (diff) |
Sort labels alphabetically
Sorts labels alphabetically on issues (and merge requests) list.
Before it was order id desc.
Now it will be consistent with sidebar and labels page.
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
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 |