Commit bebf34aa authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Make projects sort dropdown shared so it can be reused for other pages

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent acb21121
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
......
......@@ -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')
......
......@@ -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
......@@ -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
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