2014-12-04 10:10:38 +00:00
|
|
|
module SortingHelper
|
2015-02-06 03:15:05 +00:00
|
|
|
def sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_name => sort_title_name,
|
2017-03-24 00:39:12 +00:00
|
|
|
sort_value_name_desc => sort_title_name_desc,
|
2015-02-06 03:15:05 +00:00
|
|
|
sort_value_recently_updated => sort_title_recently_updated,
|
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated,
|
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
|
|
|
sort_value_oldest_created => sort_title_oldest_created,
|
|
|
|
sort_value_milestone_soon => sort_title_milestone_soon,
|
|
|
|
sort_value_milestone_later => sort_title_milestone_later,
|
2016-03-10 14:26:56 +00:00
|
|
|
sort_value_due_date_soon => sort_title_due_date_soon,
|
|
|
|
sort_value_due_date_later => sort_title_due_date_later,
|
2015-02-06 03:15:05 +00:00
|
|
|
sort_value_largest_repo => sort_title_largest_repo,
|
2016-11-22 16:58:10 +00:00
|
|
|
sort_value_largest_group => sort_title_largest_group,
|
2015-02-06 03:15:05 +00:00
|
|
|
sort_value_recently_signin => sort_title_recently_signin,
|
|
|
|
sort_value_oldest_signin => sort_title_oldest_signin,
|
2016-02-17 13:32:02 +00:00
|
|
|
sort_value_downvotes => sort_title_downvotes,
|
2016-03-14 09:46:26 +00:00
|
|
|
sort_value_upvotes => sort_title_upvotes,
|
2017-03-10 11:10:48 +00:00
|
|
|
sort_value_priority => sort_title_priority,
|
|
|
|
sort_value_label_priority => sort_title_label_priority
|
2015-02-06 03:15:05 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2016-03-04 16:53:13 +00:00
|
|
|
def projects_sort_options_hash
|
2016-08-12 19:57:19 +00:00
|
|
|
options = {
|
2016-03-04 16:53:13 +00:00
|
|
|
sort_value_name => sort_title_name,
|
2017-03-03 10:35:04 +00:00
|
|
|
sort_value_latest_activity => sort_title_latest_activity,
|
|
|
|
sort_value_oldest_activity => sort_title_oldest_activity,
|
2016-03-04 16:53:13 +00:00
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
2016-10-18 12:22:18 +00:00
|
|
|
sort_value_oldest_created => sort_title_oldest_created
|
2016-03-04 16:53:13 +00:00
|
|
|
}
|
2016-08-12 19:57:19 +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
|
|
|
|
|
|
|
|
options
|
2016-03-04 16:53:13 +00:00
|
|
|
end
|
|
|
|
|
2016-10-18 12:22:18 +00:00
|
|
|
def member_sort_options_hash
|
|
|
|
{
|
2016-11-16 21:45:35 +00:00
|
|
|
sort_value_access_level_asc => sort_title_access_level_asc,
|
|
|
|
sort_value_access_level_desc => sort_title_access_level_desc,
|
2016-10-18 12:22:18 +00:00
|
|
|
sort_value_last_joined => sort_title_last_joined,
|
|
|
|
sort_value_oldest_joined => sort_title_oldest_joined,
|
|
|
|
sort_value_name => sort_title_name_asc,
|
|
|
|
sort_value_name_desc => sort_title_name_desc,
|
|
|
|
sort_value_recently_signin => sort_title_recently_signin,
|
|
|
|
sort_value_oldest_signin => sort_title_oldest_signin
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2017-03-24 00:39:12 +00:00
|
|
|
def milestone_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_name => sort_title_name_asc,
|
|
|
|
sort_value_name_desc => sort_title_name_desc,
|
|
|
|
sort_value_due_date_soon => sort_title_due_date_soon,
|
|
|
|
sort_value_due_date_later => sort_title_due_date_later,
|
|
|
|
sort_value_start_date_soon => sort_title_start_date_soon,
|
|
|
|
sort_value_start_date_later => sort_title_start_date_later,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2017-04-18 12:48:52 +00:00
|
|
|
def branches_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_recently_updated => sort_title_recently_updated,
|
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2017-05-03 08:06:28 +00:00
|
|
|
def tags_sort_options_hash
|
|
|
|
{
|
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_recently_updated => sort_title_recently_updated,
|
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2016-03-14 09:46:26 +00:00
|
|
|
def sort_title_priority
|
2017-03-10 11:10:48 +00:00
|
|
|
'Priority'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_label_priority
|
2017-03-07 17:12:53 +00:00
|
|
|
'Label priority'
|
2016-03-14 09:46:26 +00:00
|
|
|
end
|
|
|
|
|
2014-12-04 10:10:38 +00:00
|
|
|
def sort_title_oldest_updated
|
|
|
|
'Oldest updated'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_recently_updated
|
2016-01-07 17:59:45 +00:00
|
|
|
'Last updated'
|
2014-12-04 10:10:38 +00:00
|
|
|
end
|
|
|
|
|
2017-03-03 10:35:04 +00:00
|
|
|
def sort_title_oldest_activity
|
|
|
|
'Oldest updated'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_latest_activity
|
|
|
|
'Last updated'
|
|
|
|
end
|
|
|
|
|
2014-12-04 10:10:38 +00:00
|
|
|
def sort_title_oldest_created
|
2014-12-04 10:12:51 +00:00
|
|
|
'Oldest created'
|
2014-12-04 10:10:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_recently_created
|
2016-01-07 17:59:45 +00:00
|
|
|
'Last created'
|
2014-12-04 10:10:38 +00:00
|
|
|
end
|
2015-02-06 03:15:05 +00:00
|
|
|
|
|
|
|
def sort_title_milestone_soon
|
|
|
|
'Milestone due soon'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_milestone_later
|
|
|
|
'Milestone due later'
|
|
|
|
end
|
|
|
|
|
2016-03-10 14:26:56 +00:00
|
|
|
def sort_title_due_date_soon
|
2016-03-18 17:17:01 +00:00
|
|
|
'Due soon'
|
2016-03-10 14:26:56 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_due_date_later
|
2016-03-18 17:17:01 +00:00
|
|
|
'Due later'
|
2016-03-10 14:26:56 +00:00
|
|
|
end
|
|
|
|
|
2017-03-24 00:39:12 +00:00
|
|
|
def sort_title_start_date_soon
|
|
|
|
'Start soon'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_start_date_later
|
|
|
|
'Start later'
|
|
|
|
end
|
|
|
|
|
2015-02-06 03:15:05 +00:00
|
|
|
def sort_title_name
|
|
|
|
'Name'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_largest_repo
|
|
|
|
'Largest repository'
|
|
|
|
end
|
|
|
|
|
2016-11-22 16:58:10 +00:00
|
|
|
def sort_title_largest_group
|
|
|
|
'Largest group'
|
|
|
|
end
|
|
|
|
|
2015-02-06 03:15:05 +00:00
|
|
|
def sort_title_recently_signin
|
|
|
|
'Recent sign in'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_oldest_signin
|
|
|
|
'Oldest sign in'
|
|
|
|
end
|
|
|
|
|
2016-02-17 13:32:02 +00:00
|
|
|
def sort_title_downvotes
|
|
|
|
'Least popular'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_upvotes
|
|
|
|
'Most popular'
|
|
|
|
end
|
|
|
|
|
2016-10-18 12:22:18 +00:00
|
|
|
def sort_title_last_joined
|
|
|
|
'Last joined'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_oldest_joined
|
|
|
|
'Oldest joined'
|
|
|
|
end
|
|
|
|
|
2016-11-16 21:45:35 +00:00
|
|
|
def sort_title_access_level_asc
|
|
|
|
'Access level, ascending'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_access_level_desc
|
|
|
|
'Access level, descending'
|
|
|
|
end
|
|
|
|
|
2016-10-18 12:22:18 +00:00
|
|
|
def sort_title_name_asc
|
|
|
|
'Name, ascending'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_name_desc
|
|
|
|
'Name, descending'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_last_joined
|
|
|
|
'last_joined'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_oldest_joined
|
|
|
|
'oldest_joined'
|
|
|
|
end
|
|
|
|
|
2016-11-16 21:45:35 +00:00
|
|
|
def sort_value_access_level_asc
|
|
|
|
'access_level_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_access_level_desc
|
|
|
|
'access_level_desc'
|
|
|
|
end
|
|
|
|
|
2016-10-18 12:22:18 +00:00
|
|
|
def sort_value_name_desc
|
|
|
|
'name_desc'
|
|
|
|
end
|
|
|
|
|
2016-03-14 09:46:26 +00:00
|
|
|
def sort_value_priority
|
|
|
|
'priority'
|
|
|
|
end
|
|
|
|
|
2017-03-10 11:10:48 +00:00
|
|
|
def sort_value_label_priority
|
|
|
|
'label_priority'
|
|
|
|
end
|
|
|
|
|
2015-02-06 03:15:05 +00:00
|
|
|
def sort_value_oldest_updated
|
|
|
|
'updated_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_recently_updated
|
|
|
|
'updated_desc'
|
|
|
|
end
|
|
|
|
|
2017-03-03 10:35:04 +00:00
|
|
|
def sort_value_oldest_activity
|
|
|
|
'latest_activity_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_latest_activity
|
|
|
|
'latest_activity_desc'
|
|
|
|
end
|
|
|
|
|
2015-02-06 03:15:05 +00:00
|
|
|
def sort_value_oldest_created
|
2016-07-23 23:28:12 +00:00
|
|
|
'created_asc'
|
2015-02-06 03:15:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_recently_created
|
2016-07-23 23:28:12 +00:00
|
|
|
'created_desc'
|
2015-02-06 03:15:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_milestone_soon
|
|
|
|
'milestone_due_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_milestone_later
|
|
|
|
'milestone_due_desc'
|
|
|
|
end
|
|
|
|
|
2016-03-10 14:26:56 +00:00
|
|
|
def sort_value_due_date_soon
|
|
|
|
'due_date_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_due_date_later
|
|
|
|
'due_date_desc'
|
|
|
|
end
|
|
|
|
|
2017-03-24 00:39:12 +00:00
|
|
|
def sort_value_start_date_soon
|
|
|
|
'start_date_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_start_date_later
|
|
|
|
'start_date_desc'
|
|
|
|
end
|
|
|
|
|
2015-02-06 03:15:05 +00:00
|
|
|
def sort_value_name
|
|
|
|
'name_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_largest_repo
|
2016-11-22 16:58:10 +00:00
|
|
|
'storage_size_desc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_largest_group
|
|
|
|
'storage_size_desc'
|
2015-02-06 03:15:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_recently_signin
|
|
|
|
'recent_sign_in'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_oldest_signin
|
|
|
|
'oldest_sign_in'
|
|
|
|
end
|
2016-02-17 13:32:02 +00:00
|
|
|
|
|
|
|
def sort_value_downvotes
|
|
|
|
'downvotes_desc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_upvotes
|
|
|
|
'upvotes_desc'
|
|
|
|
end
|
2014-12-04 10:10:38 +00:00
|
|
|
end
|