Make projects sort dropdown shared so it can be reused for other pages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
acb211215c
commit
bebf34aa47
4 changed files with 15 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
||||||
module ExploreHelper
|
module ExploreHelper
|
||||||
def explore_projects_filter_path(options={})
|
def filter_projects_path(options={})
|
||||||
exist_opts = {
|
exist_opts = {
|
||||||
sort: params[:sort],
|
sort: params[:sort],
|
||||||
scope: params[:scope],
|
scope: params[:scope],
|
||||||
|
@ -9,15 +9,7 @@ module ExploreHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
options = exist_opts.merge(options)
|
options = exist_opts.merge(options)
|
||||||
|
path = request.path
|
||||||
path = if explore_controller?
|
|
||||||
explore_projects_path
|
|
||||||
elsif current_action?(:starred)
|
|
||||||
starred_dashboard_projects_path
|
|
||||||
else
|
|
||||||
dashboard_projects_path
|
|
||||||
end
|
|
||||||
|
|
||||||
path << "?#{options.to_param}"
|
path << "?#{options.to_param}"
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
.nav-controls
|
.nav-controls
|
||||||
= form_tag request.original_url, method: :get, class: 'project-filter-form', id: 'project-filter-form' do |f|
|
= 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"
|
= 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?
|
- if current_user.can_create_project?
|
||||||
= link_to new_project_path, class: 'btn btn-new' do
|
= link_to new_project_path, class: 'btn btn-new' do
|
||||||
= icon('plus')
|
= icon('plus')
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
%b.caret
|
%b.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
%li
|
%li
|
||||||
= link_to explore_projects_filter_path(visibility_level: nil) do
|
= link_to filter_projects_path(visibility_level: nil) do
|
||||||
Any
|
Any
|
||||||
- Gitlab::VisibilityLevel.values.each do |level|
|
- Gitlab::VisibilityLevel.values.each do |level|
|
||||||
%li{ class: (level.to_s == params[:visibility_level]) ? 'active' : 'light' }
|
%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_icon(level)
|
||||||
= visibility_level_label(level)
|
= visibility_level_label(level)
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@
|
||||||
%b.caret
|
%b.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
%li
|
%li
|
||||||
= link_to explore_projects_filter_path(tag: nil) do
|
= link_to filter_projects_path(tag: nil) do
|
||||||
Any
|
Any
|
||||||
|
|
||||||
- @tags.each do |tag|
|
- @tags.each do |tag|
|
||||||
%li{ class: (tag.name == params[:tag]) ? 'active' : 'light' }
|
%li{ class: (tag.name == params[:tag]) ? 'active' : 'light' }
|
||||||
= link_to explore_projects_filter_path(tag: tag.name) do
|
= link_to filter_projects_path(tag: tag.name) do
|
||||||
%i.fa.fa-tag
|
= icon('tag')
|
||||||
= tag.name
|
= tag.name
|
||||||
|
|
|
@ -8,21 +8,21 @@
|
||||||
%b.caret
|
%b.caret
|
||||||
%ul.dropdown-menu.dropdown-menu-align-right
|
%ul.dropdown-menu.dropdown-menu-align-right
|
||||||
%li
|
%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
|
= 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
|
= 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
|
= 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
|
= 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
|
= sort_title_oldest_updated
|
||||||
%li.divider
|
%li.divider
|
||||||
%li
|
%li
|
||||||
- if params[:archived].present?
|
- 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
|
Hide archived projects
|
||||||
- else
|
- 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
|
Show archived projects
|
Loading…
Reference in a new issue