diff options
author | Ezekiel Kigbo <ekigbo@gitlab.com> | 2019-04-17 14:02:34 +0300 |
---|---|---|
committer | Ezekiel Kigbo <ekigbo@gitlab.com> | 2019-05-06 18:42:43 +0300 |
commit | b736a9f000d1e1f6c2c94ea74a700abf5a44139e (patch) | |
tree | f24f71c49402bb77cd4a03dcd0a0566cb63d6f58 /app/helpers/sorting_helper.rb | |
parent | 5f22907418397861d9b07cbaeea05ef7264d5605 (diff) |
Minor review fixes
Externalize strings
Simplify locals passed through views
Ensure we can still filter when logged out
Cleanup conditional rendering for explore filters
Diffstat (limited to 'app/helpers/sorting_helper.rb')
-rw-r--r-- | app/helpers/sorting_helper.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb index dfb741269eb..df2f4468199 100644 --- a/app/helpers/sorting_helper.rb +++ b/app/helpers/sorting_helper.rb @@ -30,8 +30,10 @@ module SortingHelper end def projects_sort_options_hash - is_admin = current_controller?('admin/projects') + Feature.enabled?(:project_list_filter_bar) && !current_controller?('admin/projects') ? projects_sort_common_options_hash : projects_sort_admin_options_hash + end + def projects_sort_admin_options_hash options = { sort_value_latest_activity => sort_title_latest_activity, sort_value_name => sort_title_name, @@ -41,18 +43,20 @@ module SortingHelper sort_value_most_stars => sort_title_most_stars } - if is_admin + if current_controller?('admin/projects') options[sort_value_largest_repo] = sort_title_largest_repo end - search_bar_options = { + options + end + + def projects_sort_common_options_hash + { sort_value_latest_activity => sort_title_latest_activity, sort_value_recently_created => sort_title_created_date, sort_value_name => sort_title_name, sort_value_most_stars => sort_title_stars } - - Feature.enabled?(:project_list_filter_bar) && !is_admin ? search_bar_options : options end def projects_sort_option_titles @@ -222,7 +226,7 @@ module SortingHelper link_class += ' disabled' end - link_to(reverse_url, type: 'button', class: link_class, title: 'Sort direction') do + link_to(reverse_url, type: 'button', class: link_class, title: s_('SortOptions|Sort direction')) do sprite_icon("sort-#{issuable_sort_icon_suffix(sort_value)}", size: 16) end end @@ -238,7 +242,7 @@ module SortingHelper link_class += ' disabled' end - link_to(reverse_url, type: 'button', class: link_class, title: 'Sort direction') do + link_to(reverse_url, type: 'button', class: link_class, title: s_('SortOptions|Sort direction')) do sprite_icon("sort-#{issuable_sort_icon_suffix(sort_value)}", size: 16) end end @@ -525,7 +529,6 @@ module SortingHelper 'stars_desc' end - # TODO: currently not implemented AFAIK def sort_value_most_stars_asc 'stars_asc' end |