2018-08-18 11:19:57 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-12-04 10:10:38 +00:00
|
|
|
module SortingHelper
|
2020-12-16 12:09:53 +00:00
|
|
|
include SortingTitlesValuesHelper
|
|
|
|
|
2021-08-16 06:09:08 +00:00
|
|
|
# rubocop: disable Metrics/AbcSize
|
2015-02-06 03:15:05 +00:00
|
|
|
def sort_options_hash
|
|
|
|
{
|
2019-05-21 22:46:12 +00:00
|
|
|
sort_value_created_date => sort_title_created_date,
|
|
|
|
sort_value_downvotes => sort_title_downvotes,
|
|
|
|
sort_value_due_date => sort_title_due_date,
|
|
|
|
sort_value_due_date_later => sort_title_due_date_later,
|
|
|
|
sort_value_due_date_soon => sort_title_due_date_soon,
|
|
|
|
sort_value_label_priority => sort_title_label_priority,
|
|
|
|
sort_value_largest_group => sort_title_largest_group,
|
|
|
|
sort_value_largest_repo => sort_title_largest_repo,
|
|
|
|
sort_value_milestone => sort_title_milestone,
|
|
|
|
sort_value_milestone_later => sort_title_milestone_later,
|
|
|
|
sort_value_milestone_soon => sort_title_milestone_soon,
|
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_name_desc => sort_title_name_desc,
|
|
|
|
sort_value_oldest_created => sort_title_oldest_created,
|
|
|
|
sort_value_oldest_signin => sort_title_oldest_signin,
|
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated,
|
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
|
|
|
sort_value_recently_signin => sort_title_recently_signin,
|
|
|
|
sort_value_recently_updated => sort_title_recently_updated,
|
|
|
|
sort_value_popularity => sort_title_popularity,
|
|
|
|
sort_value_priority => sort_title_priority,
|
2021-07-09 12:08:17 +00:00
|
|
|
sort_value_merged_date => sort_title_merged_date,
|
|
|
|
sort_value_merged_recently => sort_title_merged_recently,
|
|
|
|
sort_value_merged_earlier => sort_title_merged_earlier,
|
2021-08-16 06:09:08 +00:00
|
|
|
sort_value_closed_date => sort_title_closed_date,
|
|
|
|
sort_value_closed_recently => sort_title_closed_recently,
|
|
|
|
sort_value_closed_earlier => sort_title_closed_earlier,
|
2019-05-21 22:46:12 +00:00
|
|
|
sort_value_upvotes => sort_title_upvotes,
|
|
|
|
sort_value_contacted_date => sort_title_contacted_date,
|
2019-09-18 21:06:34 +00:00
|
|
|
sort_value_relative_position => sort_title_relative_position,
|
|
|
|
sort_value_size => sort_title_size,
|
2021-09-09 09:11:16 +00:00
|
|
|
sort_value_expire_date => sort_title_expire_date,
|
|
|
|
sort_value_title => sort_title_title
|
2015-02-06 03:15:05 +00:00
|
|
|
}
|
|
|
|
end
|
2021-08-16 06:09:08 +00:00
|
|
|
# rubocop: enable Metrics/AbcSize
|
2015-02-06 03:15:05 +00:00
|
|
|
|
2016-03-04 16:53:13 +00:00
|
|
|
def projects_sort_options_hash
|
2019-07-09 11:31:57 +00:00
|
|
|
use_old_sorting = Feature.disabled?(:project_list_filter_bar) || current_controller?('admin/projects')
|
2019-04-12 12:14:28 +00:00
|
|
|
|
2019-07-08 06:33:42 +00:00
|
|
|
options = {
|
|
|
|
sort_value_latest_activity => sort_title_latest_activity,
|
|
|
|
sort_value_recently_created => sort_title_created_date,
|
|
|
|
sort_value_name => sort_title_name,
|
2020-11-23 15:09:37 +00:00
|
|
|
sort_value_name_desc => sort_title_name_desc,
|
2019-07-08 06:33:42 +00:00
|
|
|
sort_value_stars_desc => sort_title_stars
|
|
|
|
}
|
|
|
|
|
|
|
|
if use_old_sorting
|
|
|
|
options = options.merge({
|
|
|
|
sort_value_oldest_activity => sort_title_oldest_activity,
|
|
|
|
sort_value_oldest_created => sort_title_oldest_created,
|
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
|
|
|
sort_value_stars_desc => sort_title_most_stars
|
|
|
|
})
|
|
|
|
end
|
2016-08-12 19:57:19 +00:00
|
|
|
|
2019-04-17 11:02:34 +00:00
|
|
|
if current_controller?('admin/projects')
|
2017-02-21 23:50:22 +00:00
|
|
|
options[sort_value_largest_repo] = sort_title_largest_repo
|
2016-08-12 19:57:19 +00:00
|
|
|
end
|
|
|
|
|
2019-04-17 11:02:34 +00:00
|
|
|
options
|
|
|
|
end
|
|
|
|
|
2021-12-06 18:14:09 +00:00
|
|
|
def forks_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_recently_created => sort_title_created_date,
|
|
|
|
sort_value_oldest_created => sort_title_created_date,
|
|
|
|
sort_value_latest_activity => sort_title_latest_activity,
|
|
|
|
sort_value_oldest_activity => sort_title_latest_activity
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2019-04-05 12:41:28 +00:00
|
|
|
def projects_sort_option_titles
|
2019-07-08 06:33:42 +00:00
|
|
|
# Only used for the project filter search bar
|
|
|
|
projects_sort_options_hash.merge({
|
2019-04-05 12:41:28 +00:00
|
|
|
sort_value_oldest_activity => sort_title_latest_activity,
|
2019-04-12 12:14:28 +00:00
|
|
|
sort_value_oldest_created => sort_title_created_date,
|
2019-04-05 12:41:28 +00:00
|
|
|
sort_value_name_desc => sort_title_name,
|
2019-04-19 08:36:16 +00:00
|
|
|
sort_value_stars_asc => sort_title_stars
|
2019-06-17 02:08:10 +00:00
|
|
|
})
|
2019-04-05 12:41:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def projects_reverse_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_latest_activity => sort_value_oldest_activity,
|
|
|
|
sort_value_recently_created => sort_value_oldest_created,
|
|
|
|
sort_value_name => sort_value_name_desc,
|
2019-04-19 08:36:16 +00:00
|
|
|
sort_value_stars_desc => sort_value_stars_asc,
|
2019-04-05 12:41:28 +00:00
|
|
|
sort_value_oldest_activity => sort_value_latest_activity,
|
|
|
|
sort_value_oldest_created => sort_value_recently_created,
|
|
|
|
sort_value_name_desc => sort_value_name,
|
2019-04-19 08:36:16 +00:00
|
|
|
sort_value_stars_asc => sort_value_stars_desc
|
2019-04-05 12:41:28 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2021-12-06 18:14:09 +00:00
|
|
|
def forks_reverse_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_recently_created => sort_value_oldest_created,
|
|
|
|
sort_value_oldest_created => sort_value_recently_created,
|
|
|
|
sort_value_latest_activity => sort_value_oldest_activity,
|
|
|
|
sort_value_oldest_activity => sort_value_latest_activity
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2017-10-04 14:10:24 +00:00
|
|
|
def groups_sort_options_hash
|
2017-12-20 12:09:35 +00:00
|
|
|
{
|
2018-10-11 14:14:44 +00:00
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_name_desc => sort_title_name_desc,
|
2017-10-04 14:10:24 +00:00
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
2018-10-11 14:14:44 +00:00
|
|
|
sort_value_oldest_created => sort_title_oldest_created,
|
2020-11-23 15:09:37 +00:00
|
|
|
sort_value_latest_activity => sort_title_recently_updated,
|
|
|
|
sort_value_oldest_activity => sort_title_oldest_updated
|
2017-10-04 14:10:24 +00:00
|
|
|
}
|
2017-12-20 12:09:35 +00:00
|
|
|
end
|
2017-10-04 14:10:24 +00:00
|
|
|
|
2018-10-11 14:14:44 +00:00
|
|
|
def subgroups_sort_options_hash
|
|
|
|
groups_sort_options_hash.merge(
|
2019-04-19 08:36:16 +00:00
|
|
|
sort_value_stars_desc => sort_title_most_stars
|
2018-10-11 14:14:44 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2017-12-20 12:09:35 +00:00
|
|
|
def admin_groups_sort_options_hash
|
|
|
|
groups_sort_options_hash.merge(
|
|
|
|
sort_value_largest_group => sort_title_largest_group
|
|
|
|
)
|
2017-10-04 14:10:24 +00:00
|
|
|
end
|
|
|
|
|
2022-04-05 09:09:24 +00:00
|
|
|
def milestones_sort_options_hash
|
2017-03-24 00:39:12 +00:00
|
|
|
{
|
2017-09-23 00:46:53 +00:00
|
|
|
sort_value_due_date_soon => sort_title_due_date_soon,
|
2022-04-05 09:09:24 +00:00
|
|
|
sort_value_due_date_later => sort_title_due_date_later,
|
|
|
|
sort_value_start_date_soon => sort_title_start_date_soon,
|
2017-09-23 00:46:53 +00:00
|
|
|
sort_value_start_date_later => sort_title_start_date_later,
|
2022-04-05 09:09:24 +00:00
|
|
|
sort_value_name => sort_title_name_asc,
|
|
|
|
sort_value_name_desc => sort_title_name_desc
|
2017-03-24 00:39:12 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2017-04-18 12:48:52 +00:00
|
|
|
def branches_sort_options_hash
|
|
|
|
{
|
2017-09-23 00:46:53 +00:00
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated,
|
|
|
|
sort_value_recently_updated => sort_title_recently_updated
|
2017-04-18 12:48:52 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2017-05-03 08:06:28 +00:00
|
|
|
def tags_sort_options_hash
|
|
|
|
{
|
2017-09-23 00:46:53 +00:00
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated,
|
|
|
|
sort_value_recently_updated => sort_title_recently_updated
|
2017-05-03 08:06:28 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-09-10 11:38:29 +00:00
|
|
|
def label_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_name_desc => sort_title_name_desc,
|
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
|
|
|
sort_value_oldest_created => sort_title_oldest_created,
|
|
|
|
sort_value_recently_updated => sort_title_recently_updated,
|
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-11-29 12:00:20 +00:00
|
|
|
def users_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_recently_signin => sort_title_recently_signin,
|
|
|
|
sort_value_oldest_signin => sort_title_oldest_signin,
|
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
|
|
|
sort_value_oldest_created => sort_title_oldest_created,
|
|
|
|
sort_value_recently_updated => sort_title_recently_updated,
|
2019-01-07 11:54:41 +00:00
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated,
|
|
|
|
sort_value_recently_last_activity => sort_title_recently_last_activity,
|
|
|
|
sort_value_oldest_last_activity => sort_title_oldest_last_activity
|
2018-11-29 12:00:20 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2022-03-30 09:08:12 +00:00
|
|
|
def runners_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_created_date => sort_title_created_date,
|
|
|
|
sort_value_contacted_date => sort_title_contacted_date
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2019-01-28 12:19:53 +00:00
|
|
|
def starrers_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_name_desc => sort_title_name_desc,
|
|
|
|
sort_value_recently_created => sort_title_recently_starred,
|
|
|
|
sort_value_oldest_created => sort_title_oldest_starred
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2017-09-23 00:46:53 +00:00
|
|
|
def sortable_item(item, path, sorted_by)
|
|
|
|
link_to item, path, class: sorted_by == item ? 'is-active' : ''
|
2017-03-10 11:10:48 +00:00
|
|
|
end
|
|
|
|
|
2018-12-06 16:57:19 +00:00
|
|
|
def issuable_sort_option_overrides
|
|
|
|
{
|
|
|
|
sort_value_oldest_created => sort_value_created_date,
|
|
|
|
sort_value_oldest_updated => sort_value_recently_updated,
|
2019-05-04 16:16:47 +00:00
|
|
|
sort_value_milestone_later => sort_value_milestone,
|
|
|
|
sort_value_due_date_later => sort_value_due_date,
|
2021-07-09 12:08:17 +00:00
|
|
|
sort_value_merged_recently => sort_value_merged_date,
|
2021-08-16 06:09:08 +00:00
|
|
|
sort_value_closed_recently => sort_value_closed_date,
|
2021-09-09 09:11:16 +00:00
|
|
|
sort_value_least_popular => sort_value_popularity,
|
|
|
|
sort_value_title_desc => sort_value_title
|
2018-12-06 16:57:19 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def issuable_reverse_sort_order_hash
|
|
|
|
{
|
|
|
|
sort_value_created_date => sort_value_oldest_created,
|
|
|
|
sort_value_recently_created => sort_value_oldest_created,
|
|
|
|
sort_value_recently_updated => sort_value_oldest_updated,
|
2019-05-04 16:16:47 +00:00
|
|
|
sort_value_milestone => sort_value_milestone_later,
|
|
|
|
sort_value_due_date => sort_value_due_date_later,
|
|
|
|
sort_value_due_date_soon => sort_value_due_date_later,
|
2021-07-09 12:08:17 +00:00
|
|
|
sort_value_merged_date => sort_value_merged_recently,
|
|
|
|
sort_value_merged_earlier => sort_value_merged_recently,
|
2021-08-16 06:09:08 +00:00
|
|
|
sort_value_closed_date => sort_value_closed_recently,
|
|
|
|
sort_value_closed_earlier => sort_value_closed_recently,
|
2019-05-04 16:16:47 +00:00
|
|
|
sort_value_popularity => sort_value_least_popular,
|
2021-09-09 09:11:16 +00:00
|
|
|
sort_value_most_popular => sort_value_least_popular,
|
|
|
|
sort_value_title => sort_value_title_desc
|
2018-12-06 16:57:19 +00:00
|
|
|
}.merge(issuable_sort_option_overrides)
|
|
|
|
end
|
|
|
|
|
2020-01-30 15:09:15 +00:00
|
|
|
def audit_logs_sort_order_hash
|
|
|
|
{
|
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
|
|
|
sort_value_oldest_created => sort_title_oldest_created
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-12-06 16:57:19 +00:00
|
|
|
def issuable_sort_option_title(sort_value)
|
|
|
|
sort_value = issuable_sort_option_overrides[sort_value] || sort_value
|
|
|
|
|
|
|
|
sort_options_hash[sort_value]
|
|
|
|
end
|
|
|
|
|
2022-05-13 12:08:49 +00:00
|
|
|
def issuable_sort_options(viewing_issues, viewing_merge_requests)
|
|
|
|
options = [
|
|
|
|
{ value: sort_value_priority, text: sort_title_priority, href: page_filter_path(sort: sort_value_priority) },
|
|
|
|
{ value: sort_value_created_date, text: sort_title_created_date, href: page_filter_path(sort: sort_value_created_date) },
|
|
|
|
{ value: sort_value_recently_updated, text: sort_title_recently_updated, href: page_filter_path(sort: sort_value_recently_updated) },
|
|
|
|
{ value: sort_value_milestone, text: sort_title_milestone, href: page_filter_path(sort: sort_value_milestone) }
|
|
|
|
]
|
|
|
|
|
|
|
|
options.concat([due_date_option]) if viewing_issues
|
|
|
|
|
|
|
|
options.concat([popularity_option, label_priority_option])
|
|
|
|
options.concat([merged_option, closed_option]) if viewing_merge_requests
|
|
|
|
options.concat([relative_position_option]) if viewing_issues
|
|
|
|
|
|
|
|
options.concat([title_option])
|
|
|
|
end
|
|
|
|
|
|
|
|
def due_date_option
|
|
|
|
{ value: sort_value_due_date, text: sort_title_due_date, href: page_filter_path(sort: sort_value_due_date) }
|
|
|
|
end
|
|
|
|
|
|
|
|
def popularity_option
|
|
|
|
{ value: sort_value_popularity, text: sort_title_popularity, href: page_filter_path(sort: sort_value_popularity) }
|
|
|
|
end
|
|
|
|
|
|
|
|
def label_priority_option
|
|
|
|
{ value: sort_value_label_priority, text: sort_title_label_priority, href: page_filter_path(sort: sort_value_label_priority) }
|
|
|
|
end
|
|
|
|
|
|
|
|
def merged_option
|
|
|
|
{ value: sort_value_merged_date, text: sort_title_merged_date, href: page_filter_path(sort: sort_value_merged_date) }
|
|
|
|
end
|
|
|
|
|
|
|
|
def closed_option
|
|
|
|
{ value: sort_value_closed_date, text: sort_title_closed_date, href: page_filter_path(sort: sort_value_closed_date) }
|
|
|
|
end
|
|
|
|
|
|
|
|
def relative_position_option
|
|
|
|
{ value: sort_value_relative_position, text: sort_title_relative_position, href: page_filter_path(sort: sort_value_relative_position) }
|
|
|
|
end
|
|
|
|
|
|
|
|
def title_option
|
|
|
|
{ value: sort_value_title, text: sort_title_title, href: page_filter_path(sort: sort_value_title) }
|
|
|
|
end
|
|
|
|
|
2019-07-09 00:33:30 +00:00
|
|
|
def sort_direction_icon(sort_value)
|
2018-12-13 00:59:31 +00:00
|
|
|
case sort_value
|
2021-08-16 06:09:08 +00:00
|
|
|
when sort_value_milestone, sort_value_due_date, sort_value_merged_date, sort_value_closed_date, /_asc\z/
|
2019-07-09 00:33:30 +00:00
|
|
|
'sort-lowest'
|
2018-12-13 00:59:31 +00:00
|
|
|
else
|
2019-07-09 00:33:30 +00:00
|
|
|
'sort-highest'
|
2018-12-13 00:59:31 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-07-09 00:33:30 +00:00
|
|
|
def sort_direction_button(reverse_url, reverse_sort, sort_value)
|
2021-04-10 03:09:09 +00:00
|
|
|
link_class = 'gl-button btn btn-default btn-icon has-tooltip reverse-sort-btn qa-reverse-sort rspec-reverse-sort'
|
2019-07-09 00:33:30 +00:00
|
|
|
icon = sort_direction_icon(sort_value)
|
|
|
|
url = reverse_url
|
2018-12-06 16:57:19 +00:00
|
|
|
|
2019-07-09 00:33:30 +00:00
|
|
|
unless reverse_sort
|
|
|
|
url = '#'
|
2018-12-06 16:57:19 +00:00
|
|
|
link_class += ' disabled'
|
|
|
|
end
|
|
|
|
|
2019-07-09 00:33:30 +00:00
|
|
|
link_to(url, type: 'button', class: link_class, title: s_('SortOptions|Sort direction')) do
|
2020-08-10 18:09:54 +00:00
|
|
|
sprite_icon(icon)
|
2018-12-06 16:57:19 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-07-09 00:33:30 +00:00
|
|
|
def issuable_sort_direction_button(sort_value)
|
|
|
|
reverse_sort = issuable_reverse_sort_order_hash[sort_value]
|
|
|
|
url = page_filter_path(sort: reverse_sort)
|
|
|
|
|
|
|
|
sort_direction_button(url, reverse_sort, sort_value)
|
|
|
|
end
|
|
|
|
|
2019-04-05 12:41:28 +00:00
|
|
|
def project_sort_direction_button(sort_value)
|
|
|
|
reverse_sort = projects_reverse_sort_options_hash[sort_value]
|
2019-07-09 00:33:30 +00:00
|
|
|
url = filter_projects_path(sort: reverse_sort)
|
2019-04-05 12:41:28 +00:00
|
|
|
|
2019-07-09 00:33:30 +00:00
|
|
|
sort_direction_button(url, reverse_sort, sort_value)
|
2019-04-05 12:41:28 +00:00
|
|
|
end
|
|
|
|
|
2020-07-21 12:09:30 +00:00
|
|
|
def packages_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_recently_created => sort_title_created_date,
|
|
|
|
sort_value_oldest_created => sort_title_created_date,
|
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_name_desc => sort_title_name,
|
|
|
|
sort_value_version_desc => sort_title_version,
|
|
|
|
sort_value_version_asc => sort_title_version,
|
|
|
|
sort_value_type_desc => sort_title_type,
|
|
|
|
sort_value_type_asc => sort_title_type,
|
|
|
|
sort_value_project_name_desc => sort_title_project_name,
|
|
|
|
sort_value_project_name_asc => sort_title_project_name
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def packages_reverse_sort_order_hash
|
|
|
|
{
|
|
|
|
sort_value_recently_created => sort_value_oldest_created,
|
|
|
|
sort_value_oldest_created => sort_value_recently_created,
|
|
|
|
sort_value_name => sort_value_name_desc,
|
|
|
|
sort_value_name_desc => sort_value_name,
|
|
|
|
sort_value_version_desc => sort_value_version_asc,
|
|
|
|
sort_value_version_asc => sort_value_version_desc,
|
|
|
|
sort_value_type_desc => sort_value_type_asc,
|
|
|
|
sort_value_type_asc => sort_value_type_desc,
|
|
|
|
sort_value_project_name_desc => sort_value_project_name_asc,
|
|
|
|
sort_value_project_name_asc => sort_value_project_name_desc
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def packages_sort_option_title(sort_value)
|
|
|
|
packages_sort_options_hash[sort_value] || sort_title_created_date
|
|
|
|
end
|
|
|
|
|
|
|
|
def packages_sort_direction_button(sort_value)
|
|
|
|
reverse_sort = packages_reverse_sort_order_hash[sort_value]
|
|
|
|
url = package_sort_path(sort: reverse_sort)
|
|
|
|
|
|
|
|
sort_direction_button(url, reverse_sort, sort_value)
|
|
|
|
end
|
2021-12-06 18:14:09 +00:00
|
|
|
|
|
|
|
def forks_sort_direction_button(sort_value, without = [:state, :scope, :label_name, :milestone_id, :assignee_id, :author_id])
|
|
|
|
reverse_sort = forks_reverse_sort_options_hash[sort_value]
|
|
|
|
url = page_filter_path(sort: reverse_sort, without: without)
|
|
|
|
|
|
|
|
sort_direction_button(url, reverse_sort, sort_value)
|
|
|
|
end
|
2022-03-04 00:18:28 +00:00
|
|
|
|
|
|
|
def admin_users_sort_options(path_params)
|
|
|
|
users_sort_options_hash.map do |value, text|
|
|
|
|
{
|
|
|
|
value: value,
|
|
|
|
text: text,
|
|
|
|
href: admin_users_path(sort: value, **path_params)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
2014-12-04 10:10:38 +00:00
|
|
|
end
|
2020-05-14 12:08:21 +00:00
|
|
|
|
2021-05-11 21:10:21 +00:00
|
|
|
SortingHelper.prepend_mod_with('SortingHelper')
|