Commit f026e53c authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'label-filter' into 'master'

Fixed not being able to filter by any or no labels

Brings back the options to filter by any or no label

Closes #15008 

![Screen_Shot_2016-04-07_at_11.26.41](/uploads/20d949b19f537d830118532e1d44feb7/Screen_Shot_2016-04-07_at_11.26.41.png)

See merge request !3589
parents c7460469 a6ba94db
...@@ -218,7 +218,7 @@ class @LabelsSelect ...@@ -218,7 +218,7 @@ class @LabelsSelect
selectable: true selectable: true
toggleLabel: (selected) -> toggleLabel: (selected) ->
if selected and selected.title isnt 'Any Label' if selected and selected.title?
selected.title selected.title
else else
defaultLabel defaultLabel
......
- if params[:label_name].present? - if params[:label_name].present?
= hidden_field_tag(:label_name, params[:label_name]) = hidden_field_tag(:label_name, params[:label_name])
.dropdown .dropdown
%button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.try(:id), labels: labels_filter_path, default_label: "Label"}} %button.dropdown-menu-toggle.js-label-select.js-filter-submit.js-extra-options{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.try(:id), labels: labels_filter_path, default_label: "Label"}}
%span.dropdown-toggle-text %span.dropdown-toggle-text
= h(params[:label_name].presence || "Label") = h(params[:label_name].presence || "Label")
= icon('chevron-down') = icon('chevron-down')
......
...@@ -76,6 +76,37 @@ describe 'Filter issues', feature: true do ...@@ -76,6 +76,37 @@ describe 'Filter issues', feature: true do
end end
end end
describe 'Filter issues for label from issues#index', js: true do
before do
visit namespace_project_issues_path(project.namespace, project)
find('.js-label-select').click
end
it 'should filter by any label' do
find('.dropdown-menu-labels a', text: 'Any Label').click
page.within '.labels-filter' do
expect(page).to have_content 'Any Label'
end
expect(find('.js-label-select .dropdown-toggle-text')).to have_content('Label')
end
it 'should filter by no label' do
find('.dropdown-menu-labels a', text: 'No Label').click
page.within '.labels-filter' do
expect(page).to have_content 'No Label'
end
expect(find('.js-label-select .dropdown-toggle-text')).to have_content('No Label')
end
it 'should filter by no label' do
find('.dropdown-menu-labels a', text: label.title).click
page.within '.labels-filter' do
expect(page).to have_content label.title
end
expect(find('.js-label-select .dropdown-toggle-text')).to have_content(label.title)
end
end
describe 'Filter issues for assignee and label from issues#index' do describe 'Filter issues for assignee and label from issues#index' do
before do before do
......
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