2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
module SortingHelper
|
|
|
|
def sort_options_hash
|
|
|
|
{
|
2018-03-17 18:26:18 +05:30
|
|
|
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,
|
2015-04-26 12:48:37 +05:30
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
2018-03-17 18:26:18 +05:30
|
|
|
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,
|
2018-12-05 23:21:45 +05:30
|
|
|
sort_value_upvotes => sort_title_upvotes,
|
|
|
|
sort_value_contacted_date => sort_title_contacted_date
|
2015-04-26 12:48:37 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
def projects_sort_options_hash
|
2016-09-13 17:45:13 +05:30
|
|
|
options = {
|
2018-03-17 18:26:18 +05:30
|
|
|
sort_value_latest_activity => sort_title_latest_activity,
|
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_oldest_activity => sort_title_oldest_activity,
|
|
|
|
sort_value_oldest_created => sort_title_oldest_created,
|
2018-12-05 23:21:45 +05:30
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
|
|
|
sort_value_most_stars => sort_title_most_stars
|
2016-06-02 11:05:42 +05:30
|
|
|
}
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
if current_controller?('admin/projects')
|
2017-08-17 22:00:37 +05:30
|
|
|
options[sort_value_largest_repo] = sort_title_largest_repo
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
options
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def groups_sort_options_hash
|
|
|
|
{
|
2018-12-13 13:39:08 +05:30
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_name_desc => sort_title_name_desc,
|
2018-03-17 18:26:18 +05:30
|
|
|
sort_value_recently_created => sort_title_recently_created,
|
2018-12-13 13:39:08 +05:30
|
|
|
sort_value_oldest_created => sort_title_oldest_created,
|
2018-03-17 18:26:18 +05:30
|
|
|
sort_value_recently_updated => sort_title_recently_updated,
|
2018-12-13 13:39:08 +05:30
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated
|
2018-03-17 18:26:18 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
def subgroups_sort_options_hash
|
|
|
|
groups_sort_options_hash.merge(
|
|
|
|
sort_value_most_stars => sort_title_most_stars
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def admin_groups_sort_options_hash
|
|
|
|
groups_sort_options_hash.merge(
|
|
|
|
sort_value_largest_group => sort_title_largest_group
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
def member_sort_options_hash
|
|
|
|
{
|
2018-03-17 18:26:18 +05:30
|
|
|
sort_value_access_level_asc => sort_title_access_level_asc,
|
2017-08-17 22:00:37 +05:30
|
|
|
sort_value_access_level_desc => sort_title_access_level_desc,
|
2018-03-17 18:26:18 +05:30
|
|
|
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
|
2017-08-17 22:00:37 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def milestone_sort_options_hash
|
|
|
|
{
|
2018-03-17 18:26:18 +05:30
|
|
|
sort_value_name => sort_title_name_asc,
|
|
|
|
sort_value_name_desc => sort_title_name_desc,
|
|
|
|
sort_value_due_date_later => sort_title_due_date_later,
|
|
|
|
sort_value_due_date_soon => sort_title_due_date_soon,
|
|
|
|
sort_value_start_date_later => sort_title_start_date_later,
|
|
|
|
sort_value_start_date_soon => sort_title_start_date_soon
|
2017-08-17 22:00:37 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def branches_sort_options_hash
|
|
|
|
{
|
2018-03-17 18:26:18 +05:30
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated,
|
|
|
|
sort_value_recently_updated => sort_title_recently_updated
|
2017-08-17 22:00:37 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def tags_sort_options_hash
|
|
|
|
{
|
2018-03-17 18:26:18 +05:30
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
sort_value_oldest_updated => sort_title_oldest_updated,
|
|
|
|
sort_value_recently_updated => sort_title_recently_updated
|
2017-08-17 22:00:37 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
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-03-17 18:26:18 +05:30
|
|
|
def sortable_item(item, path, sorted_by)
|
|
|
|
link_to item, path, class: sorted_by == item ? 'is-active' : ''
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
# Titles.
|
|
|
|
def sort_title_access_level_asc
|
|
|
|
s_('SortOptions|Access level, ascending')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_access_level_desc
|
|
|
|
s_('SortOptions|Access level, descending')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_created_date
|
|
|
|
s_('SortOptions|Created date')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_downvotes
|
|
|
|
s_('SortOptions|Least popular')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_due_date
|
|
|
|
s_('SortOptions|Due date')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_due_date_later
|
|
|
|
s_('SortOptions|Due later')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_due_date_soon
|
|
|
|
s_('SortOptions|Due soon')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_label_priority
|
|
|
|
s_('SortOptions|Label priority')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_largest_group
|
|
|
|
s_('SortOptions|Largest group')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_largest_repo
|
|
|
|
s_('SortOptions|Largest repository')
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_last_joined
|
|
|
|
s_('SortOptions|Last joined')
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_latest_activity
|
|
|
|
s_('SortOptions|Last updated')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_milestone
|
|
|
|
s_('SortOptions|Milestone')
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_milestone_later
|
|
|
|
s_('SortOptions|Milestone due later')
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_milestone_soon
|
|
|
|
s_('SortOptions|Milestone due soon')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
def sort_title_name
|
2018-03-17 18:26:18 +05:30
|
|
|
s_('SortOptions|Name')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_name_asc
|
|
|
|
s_('SortOptions|Name, ascending')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_name_desc
|
|
|
|
s_('SortOptions|Name, descending')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_oldest_activity
|
|
|
|
s_('SortOptions|Oldest updated')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_oldest_created
|
|
|
|
s_('SortOptions|Oldest created')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_oldest_joined
|
|
|
|
s_('SortOptions|Oldest joined')
|
2016-04-02 18:10:28 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_oldest_signin
|
|
|
|
s_('SortOptions|Oldest sign in')
|
2016-04-02 18:10:28 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_oldest_updated
|
|
|
|
s_('SortOptions|Oldest updated')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_popularity
|
|
|
|
s_('SortOptions|Popularity')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_priority
|
|
|
|
s_('SortOptions|Priority')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_recently_created
|
|
|
|
s_('SortOptions|Last created')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_recently_signin
|
|
|
|
s_('SortOptions|Recent sign in')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_recently_updated
|
|
|
|
s_('SortOptions|Last updated')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_start_date_later
|
|
|
|
s_('SortOptions|Start later')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_start_date_soon
|
|
|
|
s_('SortOptions|Start soon')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_title_upvotes
|
|
|
|
s_('SortOptions|Most popular')
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
def sort_title_contacted_date
|
|
|
|
s_('SortOptions|Last Contact')
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_most_stars
|
|
|
|
s_('SortOptions|Most stars')
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
# Values.
|
2017-08-17 22:00:37 +05:30
|
|
|
def sort_value_access_level_asc
|
|
|
|
'access_level_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_access_level_desc
|
|
|
|
'access_level_desc'
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_created_date
|
|
|
|
'created_date'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_downvotes
|
|
|
|
'downvotes_desc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_due_date
|
|
|
|
'due_date'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_due_date_later
|
|
|
|
'due_date_desc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_due_date_soon
|
|
|
|
'due_date_asc'
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
def sort_value_label_priority
|
|
|
|
'label_priority'
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_largest_group
|
|
|
|
'storage_size_desc'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_largest_repo
|
|
|
|
'storage_size_desc'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_last_joined
|
|
|
|
'last_joined'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_latest_activity
|
|
|
|
'latest_activity_desc'
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_milestone
|
|
|
|
'milestone'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_milestone_later
|
|
|
|
'milestone_due_desc'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_milestone_soon
|
|
|
|
'milestone_due_asc'
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_name
|
|
|
|
'name_asc'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_name_desc
|
|
|
|
'name_desc'
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_oldest_activity
|
|
|
|
'latest_activity_asc'
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_oldest_created
|
|
|
|
'created_asc'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_oldest_signin
|
|
|
|
'oldest_sign_in'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_oldest_joined
|
|
|
|
'oldest_joined'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_oldest_updated
|
|
|
|
'updated_asc'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_popularity
|
|
|
|
'popularity'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_priority
|
|
|
|
'priority'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_recently_created
|
|
|
|
'created_desc'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_recently_signin
|
|
|
|
'recent_sign_in'
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_recently_updated
|
|
|
|
'updated_desc'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
2016-04-02 18:10:28 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def sort_value_start_date_later
|
|
|
|
'start_date_desc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_start_date_soon
|
|
|
|
'start_date_asc'
|
2016-04-02 18:10:28 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_upvotes
|
|
|
|
'upvotes_desc'
|
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
|
|
|
|
def sort_value_contacted_date
|
|
|
|
'contacted_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_most_stars
|
|
|
|
'stars_desc'
|
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|