diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-03-04 16:42:37 +0100 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-03-04 19:26:10 +0100 |
commit | bebf34aa47235899b54c54995a8b6a13534f2eab (patch) | |
tree | 5546d0cc849a5157f9f4b66ddbc47535884d9beb | |
parent | acb211215c30244612eae6219539ced4a071b0dc (diff) | |
download | gitlab-ce-bebf34aa47235899b54c54995a8b6a13534f2eab.tar.gz |
Make projects sort dropdown shared so it can be reused for other pages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | app/helpers/explore_helper.rb | 12 | ||||
-rw-r--r-- | app/views/dashboard/_projects_head.html.haml | 2 | ||||
-rw-r--r-- | app/views/explore/projects/_filter.html.haml | 10 | ||||
-rw-r--r-- | app/views/shared/projects/_dropdown.html.haml (renamed from app/views/explore/projects/_dropdown.html.haml) | 14 |
4 files changed, 15 insertions, 23 deletions
diff --git a/app/helpers/explore_helper.rb b/app/helpers/explore_helper.rb index 3648757428b..337b0aacbb5 100644 --- a/app/helpers/explore_helper.rb +++ b/app/helpers/explore_helper.rb @@ -1,5 +1,5 @@ module ExploreHelper - def explore_projects_filter_path(options={}) + def filter_projects_path(options={}) exist_opts = { sort: params[:sort], scope: params[:scope], @@ -9,15 +9,7 @@ module ExploreHelper } options = exist_opts.merge(options) - - path = if explore_controller? - explore_projects_path - elsif current_action?(:starred) - starred_dashboard_projects_path - else - dashboard_projects_path - end - + path = request.path path << "?#{options.to_param}" path end diff --git a/app/views/dashboard/_projects_head.html.haml b/app/views/dashboard/_projects_head.html.haml index 40f88261c10..9da3fcbd986 100644 --- a/app/views/dashboard/_projects_head.html.haml +++ b/app/views/dashboard/_projects_head.html.haml @@ -15,7 +15,7 @@ .nav-controls = form_tag request.original_url, method: :get, class: 'project-filter-form', id: 'project-filter-form' do |f| = search_field_tag :filter_projects, params[:filter_projects], placeholder: 'Filter by name...', class: 'project-filter-form-field form-control input-short projects-list-filter', spellcheck: false, id: 'project-filter-form-field', tabindex: "2" - = render 'explore/projects/dropdown' + = render 'shared/projects/dropdown' - if current_user.can_create_project? = link_to new_project_path, class: 'btn btn-new' do = icon('plus') diff --git a/app/views/explore/projects/_filter.html.haml b/app/views/explore/projects/_filter.html.haml index 39e3e8e2738..cd485da5104 100644 --- a/app/views/explore/projects/_filter.html.haml +++ b/app/views/explore/projects/_filter.html.haml @@ -10,11 +10,11 @@ %b.caret %ul.dropdown-menu %li - = link_to explore_projects_filter_path(visibility_level: nil) do + = link_to filter_projects_path(visibility_level: nil) do Any - Gitlab::VisibilityLevel.values.each do |level| %li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' } - = link_to explore_projects_filter_path(visibility_level: level) do + = link_to filter_projects_path(visibility_level: level) do = visibility_level_icon(level) = visibility_level_label(level) @@ -30,11 +30,11 @@ %b.caret %ul.dropdown-menu %li - = link_to explore_projects_filter_path(tag: nil) do + = link_to filter_projects_path(tag: nil) do Any - @tags.each do |tag| %li{ class: (tag.name == params[:tag]) ? 'active' : 'light' } - = link_to explore_projects_filter_path(tag: tag.name) do - %i.fa.fa-tag + = link_to filter_projects_path(tag: tag.name) do + = icon('tag') = tag.name diff --git a/app/views/explore/projects/_dropdown.html.haml b/app/views/shared/projects/_dropdown.html.haml index 8859cf1eb15..3d721c40e24 100644 --- a/app/views/explore/projects/_dropdown.html.haml +++ b/app/views/shared/projects/_dropdown.html.haml @@ -8,21 +8,21 @@ %b.caret %ul.dropdown-menu.dropdown-menu-align-right %li - = link_to explore_projects_filter_path(sort: sort_value_name) do + = link_to filter_projects_path(sort: sort_value_name) do = sort_title_name - = link_to explore_projects_filter_path(sort: sort_value_recently_created) do + = link_to filter_projects_path(sort: sort_value_recently_created) do = sort_title_recently_created - = link_to explore_projects_filter_path(sort: sort_value_oldest_created) do + = link_to filter_projects_path(sort: sort_value_oldest_created) do = sort_title_oldest_created - = link_to explore_projects_filter_path(sort: sort_value_recently_updated) do + = link_to filter_projects_path(sort: sort_value_recently_updated) do = sort_title_recently_updated - = link_to explore_projects_filter_path(sort: sort_value_oldest_updated) do + = link_to filter_projects_path(sort: sort_value_oldest_updated) do = sort_title_oldest_updated %li.divider %li - if params[:archived].present? - = link_to explore_projects_filter_path(sort: @sort, archived: nil) do + = link_to filter_projects_path(sort: @sort, archived: nil) do Hide archived projects - else - = link_to explore_projects_filter_path(sort: @sort, archived: true) do + = link_to filter_projects_path(sort: @sort, archived: true) do Show archived projects |