Add option to sort group/project members by access level

parent 59d43bea
...@@ -37,6 +37,8 @@ module SortingHelper ...@@ -37,6 +37,8 @@ module SortingHelper
def member_sort_options_hash 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_last_joined => sort_title_last_joined,
sort_value_oldest_joined => sort_title_oldest_joined, sort_value_oldest_joined => sort_title_oldest_joined,
sort_value_name => sort_title_name_asc, sort_value_name => sort_title_name_asc,
...@@ -114,6 +116,14 @@ module SortingHelper ...@@ -114,6 +116,14 @@ module SortingHelper
'Oldest joined' 'Oldest joined'
end end
def sort_title_access_level_asc
'Access level, ascending'
end
def sort_title_access_level_desc
'Access level, descending'
end
def sort_title_name_asc def sort_title_name_asc
'Name, ascending' 'Name, ascending'
end end
...@@ -130,6 +140,14 @@ module SortingHelper ...@@ -130,6 +140,14 @@ module SortingHelper
'oldest_joined' 'oldest_joined'
end end
def sort_value_access_level_asc
'access_level_asc'
end
def sort_value_access_level_desc
'access_level_desc'
end
def sort_value_name_desc def sort_value_name_desc
'name_desc' 'name_desc'
end end
......
...@@ -83,6 +83,8 @@ class Member < ActiveRecord::Base ...@@ -83,6 +83,8 @@ class Member < ActiveRecord::Base
def sort(method) def sort(method)
case method.to_s case method.to_s
when 'access_level_asc' then reorder(access_level: :asc)
when 'access_level_desc' then reorder(access_level: :desc)
when 'recent_sign_in' then order_recent_sign_in when 'recent_sign_in' then order_recent_sign_in
when 'oldest_sign_in' then order_oldest_sign_in when 'oldest_sign_in' then order_oldest_sign_in
when 'last_joined' then order_created_desc when 'last_joined' then order_created_desc
......
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