diff options
author | Fatih Acet <acetfatih@gmail.com> | 2018-11-27 02:43:49 +0100 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2018-11-29 11:53:06 +0100 |
commit | 0a2a1ed97732b0347d11d7e459487e3fd35f3b4d (patch) | |
tree | 8732a47bfacdd55c6a7c6c459b6e5ae35515ee59 | |
parent | 8b16ed0a38c03e717fe572d13772f3707b705e04 (diff) | |
download | gitlab-ce-39849_controller_sorts.tar.gz |
Button tooltip, delete unused sort attr and use qa link39849_controller_sorts
-rw-r--r-- | app/assets/stylesheets/pages/issues.scss | 10 | ||||
-rw-r--r-- | app/helpers/sorting_helper.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/issuable.rb | 2 | ||||
-rw-r--r-- | app/views/shared/issuable/_sort_dropdown.html.haml | 2 | ||||
-rw-r--r-- | spec/features/issuables/sorting_list_spec.rb | 4 | ||||
-rw-r--r-- | spec/helpers/sorting_helper_spec.rb | 2 |
6 files changed, 17 insertions, 7 deletions
diff --git a/app/assets/stylesheets/pages/issues.scss b/app/assets/stylesheets/pages/issues.scss index 8ea34f5d19d..bb6b6f84849 100644 --- a/app/assets/stylesheets/pages/issues.scss +++ b/app/assets/stylesheets/pages/issues.scss @@ -259,6 +259,16 @@ ul.related-merge-requests > li { display: block; } +.issue-sort-dropdown { + .btn-group { + width: 100%; + } + + .reverse-sort-btn { + color: $gl-text-color-secondary; + } +} + @include media-breakpoint-up(sm) { .emoji-block .row { display: flex; diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb index 296da67f751..1097bcf3482 100644 --- a/app/helpers/sorting_helper.rb +++ b/app/helpers/sorting_helper.rb @@ -148,7 +148,7 @@ module SortingHelper end def issuable_sort_direction_button(sort_value) - link_class = 'btn btn-default' + link_class = 'btn btn-default has-tooltip reverse-sort-btn qa-reverse-sort' reverse_sort = issuable_reverse_sort_order_hash[sort_value] if reverse_sort @@ -158,7 +158,7 @@ module SortingHelper link_class += ' disabled' end - link_to(reverse_url, type: 'button', class: link_class) do + 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/ diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index e598069e126..0d363ec68b7 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -146,7 +146,7 @@ module Issuable sorted = case method.to_s when 'downvotes_desc' then order_downvotes_desc - when 'label_priority', 'label_priority_asc' then order_labels_priority(excluded_labels: excluded_labels) + when 'label_priority' then order_labels_priority(excluded_labels: excluded_labels) when 'label_priority_desc' then order_labels_priority('DESC', excluded_labels: excluded_labels) when 'milestone', 'milestone_due_asc' then order_milestone_due_asc when 'milestone_due_desc' then order_milestone_due_desc diff --git a/app/views/shared/issuable/_sort_dropdown.html.haml b/app/views/shared/issuable/_sort_dropdown.html.haml index f74962da96d..c211b9fcaa2 100644 --- a/app/views/shared/issuable/_sort_dropdown.html.haml +++ b/app/views/shared/issuable/_sort_dropdown.html.haml @@ -2,7 +2,7 @@ - sort_title = issuable_sort_option_title(sort_value) - viewing_issues = controller.controller_name == 'issues' || controller.action_name == 'issues' -.dropdown.inline.prepend-left-10 +.dropdown.inline.prepend-left-10.issue-sort-dropdown .btn-group{ role: 'group' } .btn-group{ role: 'group' } %button.dropdown-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static' }, class: 'btn btn-default' } diff --git a/spec/features/issuables/sorting_list_spec.rb b/spec/features/issuables/sorting_list_spec.rb index 97a12935b28..0601dd47c03 100644 --- a/spec/features/issuables/sorting_list_spec.rb +++ b/spec/features/issuables/sorting_list_spec.rb @@ -101,7 +101,7 @@ describe 'Sort Issuable List' do expect(first_merge_request).to include(last_updated_issuable.title) expect(last_merge_request).to include(first_updated_issuable.title) - find('.issues-other-filters .filter-dropdown-container a[type=button]').click + find('.issues-other-filters .filter-dropdown-container .qa-reverse-sort').click expect(first_merge_request).to include(first_updated_issuable.title) expect(last_merge_request).to include(last_updated_issuable.title) @@ -204,7 +204,7 @@ describe 'Sort Issuable List' do expect(first_issue).to include(last_updated_issuable.title) expect(last_issue).to include(first_updated_issuable.title) - find('.issues-other-filters .filter-dropdown-container a[type=button]').click + find('.issues-other-filters .filter-dropdown-container .qa-reverse-sort').click expect(first_issue).to include(first_updated_issuable.title) expect(last_issue).to include(last_updated_issuable.title) diff --git a/spec/helpers/sorting_helper_spec.rb b/spec/helpers/sorting_helper_spec.rb index 5cb52373199..cba0d93e144 100644 --- a/spec/helpers/sorting_helper_spec.rb +++ b/spec/helpers/sorting_helper_spec.rb @@ -21,7 +21,7 @@ describe SortingHelper do describe '#issuable_sort_direction_button' do before do - allow(self).to receive(:request).and_return(double(path: 'http://test.com')) + allow(self).to receive(:request).and_return(double(path: 'http://test.com', query_parameters: {})) end it 'returns icon with sort-highest when sort is created_date' do |