Commit 38984a59 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Show active sorting method for projects list

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent ee0f5bb5
...@@ -16,6 +16,16 @@ module SortingHelper ...@@ -16,6 +16,16 @@ module SortingHelper
} }
end end
def projects_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,
}
end
def sort_title_oldest_updated def sort_title_oldest_updated
'Oldest updated' 'Oldest updated'
end end
......
- @sort ||= sort_value_recently_updated
- archived = params[:archived]
.dropdown.inline .dropdown.inline
%button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'} %button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
%span.light %span.light
- if @sort.present? = projects_sort_options_hash[@sort]
= sort_options_hash[@sort]
- else
= sort_title_recently_updated
%b.caret %b.caret
%ul.dropdown-menu.dropdown-menu-align-right %ul.dropdown-menu.dropdown-menu-align-right
%li - projects_sort_options_hash.each do |value, title|
= link_to filter_projects_path(sort: sort_value_name) do %li
= sort_title_name = link_to filter_projects_path(sort: value, archived: archived) do
= link_to filter_projects_path(sort: sort_value_recently_created) do = icon('check') if @sort == value
= sort_title_recently_created = title
= link_to filter_projects_path(sort: sort_value_oldest_created) do
= sort_title_oldest_created
= link_to filter_projects_path(sort: sort_value_recently_updated) do
= sort_title_recently_updated
= link_to filter_projects_path(sort: sort_value_oldest_updated) do
= sort_title_oldest_updated
%li.divider %li.divider
%li %li
- if params[:archived].present? = link_to filter_projects_path(sort: @sort, archived: nil) do
= link_to filter_projects_path(sort: @sort, archived: nil) do = icon('check') unless params[:archived].present?
Hide archived projects Hide archived projects
- else %li
= link_to filter_projects_path(sort: @sort, archived: true) do = link_to filter_projects_path(sort: @sort, archived: true) do
Show archived projects = icon('check') if params[:archived].present?
Show archived projects
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment