Change page_filter_path default behavior

`label_name` is now not excluded by default

Also removed `label: true` from calls to the helper
This commit is contained in:
Heinrich Lee Yu 2018-12-14 12:13:51 +08:00
parent 0087396036
commit 7d1a7261f0
8 changed files with 23 additions and 28 deletions

View file

@ -171,7 +171,6 @@ module ApplicationHelper
def page_filter_path(options = {}) def page_filter_path(options = {})
without = options.delete(:without) without = options.delete(:without)
add_label = options.delete(:label)
options = request.query_parameters.merge(options) options = request.query_parameters.merge(options)
@ -181,11 +180,7 @@ module ApplicationHelper
end end
end end
params = options.compact "#{request.path}?#{options.compact.to_param}"
params.delete(:label_name) unless add_label
"#{request.path}?#{params.to_param}"
end end
def outdated_browser? def outdated_browser?

View file

@ -164,7 +164,7 @@ module SortingHelper
reverse_sort = issuable_reverse_sort_order_hash[sort_value] reverse_sort = issuable_reverse_sort_order_hash[sort_value]
if reverse_sort if reverse_sort
reverse_url = page_filter_path(sort: reverse_sort, label: true) reverse_url = page_filter_path(sort: reverse_sort)
else else
reverse_url = '#' reverse_url = '#'
link_class += ' disabled' link_class += ' disabled'

View file

@ -6,6 +6,6 @@
= icon('chevron-down') = icon('chevron-down')
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
%li %li
= sortable_item(sort_title_created_date, page_filter_path(sort: sort_value_created_date, label: true), sorted_by) = sortable_item(sort_title_created_date, page_filter_path(sort: sort_value_created_date), sorted_by)
= sortable_item(sort_title_contacted_date, page_filter_path(sort: sort_value_contacted_date, label: true), sorted_by) = sortable_item(sort_title_contacted_date, page_filter_path(sort: sort_value_contacted_date), sorted_by)

View file

@ -8,15 +8,15 @@
= icon('chevron-down') = icon('chevron-down')
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-sort %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-sort
%li %li
= link_to page_filter_path(sort: sort_value_due_date_soon, label: true) do = link_to page_filter_path(sort: sort_value_due_date_soon) do
= sort_title_due_date_soon = sort_title_due_date_soon
= link_to page_filter_path(sort: sort_value_due_date_later, label: true) do = link_to page_filter_path(sort: sort_value_due_date_later) do
= sort_title_due_date_later = sort_title_due_date_later
= link_to page_filter_path(sort: sort_value_start_date_soon, label: true) do = link_to page_filter_path(sort: sort_value_start_date_soon) do
= sort_title_start_date_soon = sort_title_start_date_soon
= link_to page_filter_path(sort: sort_value_start_date_later, label: true) do = link_to page_filter_path(sort: sort_value_start_date_later) do
= sort_title_start_date_later = sort_title_start_date_later
= link_to page_filter_path(sort: sort_value_name, label: true) do = link_to page_filter_path(sort: sort_value_name) do
= sort_title_name_asc = sort_title_name_asc
= link_to page_filter_path(sort: sort_value_name_desc, label: true) do = link_to page_filter_path(sort: sort_value_name_desc) do
= sort_title_name_desc = sort_title_name_desc

View file

@ -4,20 +4,20 @@
%ul.nav-links.issues-state-filters.mobile-separator.nav.nav-tabs %ul.nav-links.issues-state-filters.mobile-separator.nav.nav-tabs
%li{ class: active_when(params[:state] == 'opened') }> %li{ class: active_when(params[:state] == 'opened') }>
= link_to page_filter_path(state: 'opened', label: true), id: 'state-opened', title: "Filter by #{page_context_word} that are currently opened.", data: { state: 'opened' } do = link_to page_filter_path(state: 'opened'), id: 'state-opened', title: "Filter by #{page_context_word} that are currently opened.", data: { state: 'opened' } do
#{issuables_state_counter_text(type, :opened, display_count)} #{issuables_state_counter_text(type, :opened, display_count)}
- if type == :merge_requests - if type == :merge_requests
%li{ class: active_when(params[:state] == 'merged') }> %li{ class: active_when(params[:state] == 'merged') }>
= link_to page_filter_path(state: 'merged', label: true), id: 'state-merged', title: 'Filter by merge requests that are currently merged.', data: { state: 'merged' } do = link_to page_filter_path(state: 'merged'), id: 'state-merged', title: 'Filter by merge requests that are currently merged.', data: { state: 'merged' } do
#{issuables_state_counter_text(type, :merged, display_count)} #{issuables_state_counter_text(type, :merged, display_count)}
%li{ class: active_when(params[:state] == 'closed') }> %li{ class: active_when(params[:state] == 'closed') }>
= link_to page_filter_path(state: 'closed', label: true), id: 'state-closed', title: 'Filter by merge requests that are currently closed and unmerged.', data: { state: 'closed' } do = link_to page_filter_path(state: 'closed'), id: 'state-closed', title: 'Filter by merge requests that are currently closed and unmerged.', data: { state: 'closed' } do
#{issuables_state_counter_text(type, :closed, display_count)} #{issuables_state_counter_text(type, :closed, display_count)}
- else - else
%li{ class: active_when(params[:state] == 'closed') }> %li{ class: active_when(params[:state] == 'closed') }>
= link_to page_filter_path(state: 'closed', label: true), id: 'state-closed', title: 'Filter by issues that are currently closed.', data: { state: 'closed' } do = link_to page_filter_path(state: 'closed'), id: 'state-closed', title: 'Filter by issues that are currently closed.', data: { state: 'closed' } do
#{issuables_state_counter_text(type, :closed, display_count)} #{issuables_state_counter_text(type, :closed, display_count)}
= render 'shared/issuable/nav_links/all', page_context_word: page_context_word, counter: issuables_state_counter_text(type, :all, display_count) = render 'shared/issuable/nav_links/all', page_context_word: page_context_word, counter: issuables_state_counter_text(type, :all, display_count)

View file

@ -10,11 +10,11 @@
= icon('chevron-down') = icon('chevron-down')
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
%li %li
= sortable_item(sort_title_priority, page_filter_path(sort: sort_value_priority, label: true), sort_title) = sortable_item(sort_title_priority, page_filter_path(sort: sort_value_priority), sort_title)
= sortable_item(sort_title_created_date, page_filter_path(sort: sort_value_created_date, label: true), sort_title) = sortable_item(sort_title_created_date, page_filter_path(sort: sort_value_created_date), sort_title)
= sortable_item(sort_title_recently_updated, page_filter_path(sort: sort_value_recently_updated, label: true), sort_title) = sortable_item(sort_title_recently_updated, page_filter_path(sort: sort_value_recently_updated), sort_title)
= sortable_item(sort_title_milestone, page_filter_path(sort: sort_value_milestone, label: true), sort_title) = sortable_item(sort_title_milestone, page_filter_path(sort: sort_value_milestone), sort_title)
= sortable_item(sort_title_due_date, page_filter_path(sort: sort_value_due_date, label: true), sort_title) if viewing_issues = sortable_item(sort_title_due_date, page_filter_path(sort: sort_value_due_date), sort_title) if viewing_issues
= sortable_item(sort_title_popularity, page_filter_path(sort: sort_value_popularity, label: true), sort_title) = sortable_item(sort_title_popularity, page_filter_path(sort: sort_value_popularity), sort_title)
= sortable_item(sort_title_label_priority, page_filter_path(sort: sort_value_label_priority, label: true), sort_title) = sortable_item(sort_title_label_priority, page_filter_path(sort: sort_value_label_priority), sort_title)
= issuable_sort_direction_button(sort_value) = issuable_sort_direction_button(sort_value)

View file

@ -2,5 +2,5 @@
- counter = local_assigns.fetch(:counter) - counter = local_assigns.fetch(:counter)
%li{ class: active_when(params[:state] == 'all') }> %li{ class: active_when(params[:state] == 'all') }>
= link_to page_filter_path(state: 'all', label: true), id: 'state-all', title: "Show all #{page_context_word}.", data: { state: 'all' } do = link_to page_filter_path(state: 'all'), id: 'state-all', title: "Show all #{page_context_word}.", data: { state: 'all' } do
#{counter} #{counter}

View file

@ -6,4 +6,4 @@
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-sort %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-sort
%li %li
- label_sort_options_hash.each do |value, title| - label_sort_options_hash.each do |value, title|
= sortable_item(title, page_filter_path(sort: value, label: true, subscribed: params[:subscribed]), sort_title) = sortable_item(title, page_filter_path(sort: value), sort_title)