diff options
author | Alex Hanselka <alex@gitlab.com> | 2019-01-16 21:11:24 +0300 |
---|---|---|
committer | Alex Hanselka <alex@gitlab.com> | 2019-01-16 21:11:24 +0300 |
commit | 7914dd79d7d1df970628a1dd55b7794e6b2c0237 (patch) | |
tree | 5661792f4914ff4b8581174bd35cf7f30265105a | |
parent | 300fef12295e24e33b7d180679d0f7c4333d91b7 (diff) | |
parent | d29d7c43d47641009fe0223c530507e4e4d4a904 (diff) |
Merge branch '11-6-8810-fix-weight-sort' into '11-6-stable-patch-5'
[11.6] Backport of 8810-fix-weight-sort
See merge request gitlab-org/gitlab-ce!23919
-rw-r--r-- | app/helpers/sorting_helper.rb | 19 | ||||
-rw-r--r-- | app/views/shared/issuable/_sort_dropdown.html.haml | 1 |
2 files changed, 11 insertions, 9 deletions
diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb index 67c808b167a..ebc711d4436 100644 --- a/app/helpers/sorting_helper.rb +++ b/app/helpers/sorting_helper.rb @@ -159,6 +159,15 @@ module SortingHelper sort_options_hash[sort_value] end + def issuable_sort_icon_suffix(sort_value) + case sort_value + when sort_value_milestone, sort_value_due_date, /_asc\z/ + 'lowest' + else + 'highest' + end + end + def issuable_sort_direction_button(sort_value) link_class = 'btn btn-default has-tooltip reverse-sort-btn qa-reverse-sort' reverse_sort = issuable_reverse_sort_order_hash[sort_value] @@ -171,15 +180,7 @@ module SortingHelper end link_to(reverse_url, type: 'button', class: link_class, title: 'Sort direction') do - icon_suffix = - case sort_value - when sort_value_milestone, sort_value_due_date, /_asc\z/ - 'lowest' - else - 'highest' - end - - sprite_icon("sort-#{icon_suffix}", size: 16) + sprite_icon("sort-#{issuable_sort_icon_suffix(sort_value)}", size: 16) end end diff --git a/app/views/shared/issuable/_sort_dropdown.html.haml b/app/views/shared/issuable/_sort_dropdown.html.haml index c211b9fcaa2..ec8684718e5 100644 --- a/app/views/shared/issuable/_sort_dropdown.html.haml +++ b/app/views/shared/issuable/_sort_dropdown.html.haml @@ -17,4 +17,5 @@ = sortable_item(sort_title_due_date, page_filter_path(sort: sort_value_due_date, label: true), sort_title) if viewing_issues = sortable_item(sort_title_popularity, page_filter_path(sort: sort_value_popularity, label: true), sort_title) = sortable_item(sort_title_label_priority, page_filter_path(sort: sort_value_label_priority, label: true), sort_title) + = render_if_exists('shared/ee/issuable/sort_dropdown', viewing_issues: viewing_issues, sort_title: sort_title) = issuable_sort_direction_button(sort_value) |