Commit 03843402 authored by Etienne Baqué's avatar Etienne Baqué

Updates based on maintainer review

Removed MemberSortOptionsHelper class.
parent 652f71f7
# frozen_string_literal: true
module MemberSortOptionsHelper
include SortingTitlesValuesHelper
def member_sort_options_hash
{
sort_value_access_level_asc => sort_title_access_level_asc,
sort_value_access_level_desc => sort_title_access_level_desc,
sort_value_last_joined => sort_title_last_joined,
sort_value_name => sort_title_name_asc,
sort_value_name_desc => sort_title_name_desc,
sort_value_oldest_joined => sort_title_oldest_joined,
sort_value_oldest_signin => sort_title_oldest_signin,
sort_value_recently_signin => sort_title_recently_signin
}
end
end
......@@ -2,7 +2,6 @@
module SortingHelper
include SortingTitlesValuesHelper
include MemberSortOptionsHelper
def sort_options_hash
{
......@@ -177,6 +176,19 @@ module SortingHelper
}
end
def member_sort_options_hash
{
sort_value_access_level_asc => sort_title_access_level_asc,
sort_value_access_level_desc => sort_title_access_level_desc,
sort_value_last_joined => sort_title_last_joined,
sort_value_name => sort_title_name_asc,
sort_value_name_desc => sort_title_name_desc,
sort_value_oldest_joined => sort_title_oldest_joined,
sort_value_oldest_signin => sort_title_oldest_signin,
sort_value_recently_signin => sort_title_recently_signin
}
end
def sortable_item(item, path, sorted_by)
link_to item, path, class: sorted_by == item ? 'is-active' : ''
end
......
......@@ -335,3 +335,5 @@ module SortingTitlesValuesHelper
'relevant'
end
end
SortingHelper.include_if_ee('::EE::SortingTitlesValuesHelper')
......@@ -75,93 +75,5 @@ module EE
class: "btn btn-default has-tooltip qa-reverse-sort btn-sort-direction",
title: _("Sort direction")
end
def sort_title_start_date
s_('SortOptions|Start date')
end
def sort_title_end_date
s_('SortOptions|Due date')
end
def sort_title_less_weight
s_('SortOptions|Less weight')
end
def sort_title_more_weight
s_('SortOptions|More weight')
end
def sort_title_weight
s_('SortOptions|Weight')
end
def sort_title_blocking
s_('SortOptions|Blocking')
end
def sort_title_project_name
s_('SortOptions|Project')
end
def sort_title_version
s_('SortOptions|Version')
end
def sort_title_type
s_('SortOptions|Type')
end
def sort_value_start_date
'start_date_asc'
end
def sort_value_end_date
'end_date_asc'
end
def sort_value_end_date_later
'end_date_desc'
end
def sort_value_less_weight
'weight_asc'
end
def sort_value_more_weight
'weight_desc'
end
def sort_value_weight
'weight'
end
def sort_value_blocking_desc
'blocking_issues_desc'
end
def sort_value_project_name_asc
'project_name_asc'
end
def sort_value_project_name_desc
'project_name_desc'
end
def sort_value_version_asc
'version_asc'
end
def sort_value_version_desc
'version_desc'
end
def sort_value_type_asc
'type_asc'
end
def sort_value_type_desc
'type_desc'
end
end
end
# frozen_string_literal: true
module EE
module SortingTitlesValuesHelper
def sort_title_start_date
s_('SortOptions|Start date')
end
def sort_title_end_date
s_('SortOptions|Due date')
end
def sort_title_less_weight
s_('SortOptions|Less weight')
end
def sort_title_more_weight
s_('SortOptions|More weight')
end
def sort_title_weight
s_('SortOptions|Weight')
end
def sort_title_blocking
s_('SortOptions|Blocking')
end
def sort_title_project_name
s_('SortOptions|Project')
end
def sort_title_version
s_('SortOptions|Version')
end
def sort_title_type
s_('SortOptions|Type')
end
def sort_value_start_date
'start_date_asc'
end
def sort_value_end_date
'end_date_asc'
end
def sort_value_end_date_later
'end_date_desc'
end
def sort_value_less_weight
'weight_asc'
end
def sort_value_more_weight
'weight_desc'
end
def sort_value_weight
'weight'
end
def sort_value_blocking_desc
'blocking_issues_desc'
end
def sort_value_project_name_asc
'project_name_asc'
end
def sort_value_project_name_desc
'project_name_desc'
end
def sort_value_version_asc
'version_asc'
end
def sort_value_version_desc
'version_desc'
end
def sort_value_type_asc
'type_asc'
end
def sort_value_type_desc
'type_desc'
end
end
end
......@@ -8,10 +8,8 @@ module EE
extend ::Gitlab::Utils::Override
class << self
include ::MemberSortOptionsHelper
def member_sort_options
member_sort_options_hash.keys
%w(access_level_asc access_level_desc last_joined name_asc name_desc oldest_joined oldest_sign_in recent_sign_in)
end
end
......
......@@ -2,6 +2,8 @@
require 'spec_helper'
RSpec.describe EE::API::Helpers::MembersHelpers do
include SortingHelper
let(:members_helpers) { Class.new.include(described_class).new }
before do
......@@ -33,4 +35,10 @@ RSpec.describe EE::API::Helpers::MembersHelpers do
let(:member) { create(:project_member, project: source, user: create(:user)) }
end
end
describe '.member_sort_options' do
it 'lists all keys available in group member view' do
expect(described_class.member_sort_options).to match_array(member_sort_options_hash.keys)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment