2014-12-04 05:10:38 -05:00
|
|
|
module SortingHelper
|
2015-02-05 22:15:05 -05:00
|
|
|
def 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,
|
|
|
|
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 09:26:56 -05:00
|
|
|
sort_value_due_date_soon => sort_title_due_date_soon,
|
|
|
|
sort_value_due_date_later => sort_title_due_date_later,
|
2015-02-05 22:15:05 -05:00
|
|
|
sort_value_largest_repo => sort_title_largest_repo,
|
|
|
|
sort_value_recently_signin => sort_title_recently_signin,
|
|
|
|
sort_value_oldest_signin => sort_title_oldest_signin,
|
2016-02-17 08:32:02 -05:00
|
|
|
sort_value_downvotes => sort_title_downvotes,
|
2016-03-14 05:46:26 -04:00
|
|
|
sort_value_upvotes => sort_title_upvotes,
|
|
|
|
sort_value_priority => sort_title_priority
|
2015-02-05 22:15:05 -05:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2016-03-04 11:53:13 -05:00
|
|
|
def projects_sort_options_hash
|
2016-08-12 15:57:19 -04:00
|
|
|
options = {
|
2016-03-04 11:53:13 -05:00
|
|
|
sort_value_name => sort_title_name,
|
|
|
|
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,
|
|
|
|
}
|
2016-08-12 15:57:19 -04:00
|
|
|
|
|
|
|
if current_controller?('admin/projects')
|
|
|
|
options.merge!(sort_value_largest_repo => sort_title_largest_repo)
|
|
|
|
end
|
|
|
|
|
|
|
|
options
|
2016-03-04 11:53:13 -05:00
|
|
|
end
|
|
|
|
|
2016-03-14 05:46:26 -04:00
|
|
|
def sort_title_priority
|
|
|
|
'Priority'
|
|
|
|
end
|
|
|
|
|
2014-12-04 05:10:38 -05:00
|
|
|
def sort_title_oldest_updated
|
|
|
|
'Oldest updated'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_recently_updated
|
2016-01-07 12:59:45 -05:00
|
|
|
'Last updated'
|
2014-12-04 05:10:38 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_oldest_created
|
2014-12-04 05:12:51 -05:00
|
|
|
'Oldest created'
|
2014-12-04 05:10:38 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_recently_created
|
2016-01-07 12:59:45 -05:00
|
|
|
'Last created'
|
2014-12-04 05:10:38 -05:00
|
|
|
end
|
2015-02-05 22:15:05 -05:00
|
|
|
|
|
|
|
def sort_title_milestone_soon
|
|
|
|
'Milestone due soon'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_milestone_later
|
|
|
|
'Milestone due later'
|
|
|
|
end
|
|
|
|
|
2016-03-10 09:26:56 -05:00
|
|
|
def sort_title_due_date_soon
|
2016-03-18 13:17:01 -04:00
|
|
|
'Due soon'
|
2016-03-10 09:26:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_due_date_later
|
2016-03-18 13:17:01 -04:00
|
|
|
'Due later'
|
2016-03-10 09:26:56 -05:00
|
|
|
end
|
|
|
|
|
2015-02-05 22:15:05 -05:00
|
|
|
def sort_title_name
|
|
|
|
'Name'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_largest_repo
|
|
|
|
'Largest repository'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_recently_signin
|
|
|
|
'Recent sign in'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_oldest_signin
|
|
|
|
'Oldest sign in'
|
|
|
|
end
|
|
|
|
|
2016-02-17 08:32:02 -05:00
|
|
|
def sort_title_downvotes
|
|
|
|
'Least popular'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_title_upvotes
|
|
|
|
'Most popular'
|
|
|
|
end
|
|
|
|
|
2016-03-14 05:46:26 -04:00
|
|
|
def sort_value_priority
|
|
|
|
'priority'
|
|
|
|
end
|
|
|
|
|
2015-02-05 22:15:05 -05:00
|
|
|
def sort_value_oldest_updated
|
|
|
|
'updated_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_recently_updated
|
|
|
|
'updated_desc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_oldest_created
|
2016-07-23 19:28:12 -04:00
|
|
|
'created_asc'
|
2015-02-05 22:15:05 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_recently_created
|
2016-07-23 19:28:12 -04:00
|
|
|
'created_desc'
|
2015-02-05 22:15:05 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_milestone_soon
|
|
|
|
'milestone_due_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_milestone_later
|
|
|
|
'milestone_due_desc'
|
|
|
|
end
|
|
|
|
|
2016-03-10 09:26:56 -05:00
|
|
|
def sort_value_due_date_soon
|
|
|
|
'due_date_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_due_date_later
|
|
|
|
'due_date_desc'
|
|
|
|
end
|
|
|
|
|
2015-02-05 22:15:05 -05:00
|
|
|
def sort_value_name
|
|
|
|
'name_asc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_largest_repo
|
|
|
|
'repository_size_desc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_recently_signin
|
|
|
|
'recent_sign_in'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_oldest_signin
|
|
|
|
'oldest_sign_in'
|
|
|
|
end
|
2016-02-17 08:32:02 -05:00
|
|
|
|
|
|
|
def sort_value_downvotes
|
|
|
|
'downvotes_desc'
|
|
|
|
end
|
|
|
|
|
|
|
|
def sort_value_upvotes
|
|
|
|
'upvotes_desc'
|
|
|
|
end
|
2014-12-04 05:10:38 -05:00
|
|
|
end
|