Commit 31fea922 authored by Phil Hughes's avatar Phil Hughes

Updated based on Ruby feedback

parent b5ece088
...@@ -47,7 +47,7 @@ module IssuablesHelper ...@@ -47,7 +47,7 @@ module IssuablesHelper
end end
end end
def milestone_dropdown_label(milestone_title, default_label) def milestone_dropdown_label(milestone_title, default_label = "Milestone")
if milestone_title == Milestone::Upcoming.name if milestone_title == Milestone::Upcoming.name
milestone_title = Milestone::Upcoming.title milestone_title = Milestone::Upcoming.title
end end
......
- if params[:milestone_title] - if params[:milestone_title]
= hidden_field_tag(:milestone_title, params[:milestone_title]) = hidden_field_tag(:milestone_title, params[:milestone_title])
= dropdown_tag(milestone_dropdown_label(params[:milestone_title], "Milestone"), options: { title: "Filter by milestone", toggle_class: 'js-milestone-select js-filter-submit', filter: true, dropdown_class: "dropdown-menu-selectable", = dropdown_tag(milestone_dropdown_label(params[:milestone_title]), options: { title: "Filter by milestone", toggle_class: 'js-milestone-select js-filter-submit', filter: true, dropdown_class: "dropdown-menu-selectable",
placeholder: "Search milestones", footer_content: @project.present?, data: { show_no: true, show_any: true, show_upcoming: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: @project.try(:id), milestones: milestones_filter_dropdown_path, default_label: "Milestone" } }) do placeholder: "Search milestones", footer_content: @project.present?, data: { show_no: true, show_any: true, show_upcoming: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: @project.try(:id), milestones: milestones_filter_dropdown_path, default_label: "Milestone" } }) do
- if @project - if @project
%ul.dropdown-footer-list %ul.dropdown-footer-list
......
...@@ -11,7 +11,7 @@ feature 'Issue filtering by Milestone', feature: true do ...@@ -11,7 +11,7 @@ feature 'Issue filtering by Milestone', feature: true do
visit_issues(project) visit_issues(project)
filter_by_milestone(Milestone::None.title) filter_by_milestone(Milestone::None.title)
expect(page).to have_css('.issue .title', count: 1) expect(page).to have_css('.issue', count: 1)
end end
context 'filters by upcoming milestone', js: true do context 'filters by upcoming milestone', js: true do
...@@ -22,7 +22,7 @@ feature 'Issue filtering by Milestone', feature: true do ...@@ -22,7 +22,7 @@ feature 'Issue filtering by Milestone', feature: true do
visit_issues(project) visit_issues(project)
filter_by_milestone(Milestone::Upcoming.title) filter_by_milestone(Milestone::Upcoming.title)
expect(page).to have_css('.issue .title', count: 0) expect(page).to have_css('.issue', count: 0)
end end
it 'should show issues in future' do it 'should show issues in future' do
......
...@@ -11,7 +11,7 @@ feature 'Merge Request filtering by Milestone', feature: true do ...@@ -11,7 +11,7 @@ feature 'Merge Request filtering by Milestone', feature: true do
visit_merge_requests(project) visit_merge_requests(project)
filter_by_milestone(Milestone::None.title) filter_by_milestone(Milestone::None.title)
expect(page).to have_css('.merge-request-title', count: 1) expect(page).to have_css('.merge-request', count: 1)
end end
context 'filters by upcoming milestone', js: true do context 'filters by upcoming milestone', js: true do
...@@ -22,7 +22,7 @@ feature 'Merge Request filtering by Milestone', feature: true do ...@@ -22,7 +22,7 @@ feature 'Merge Request filtering by Milestone', feature: true do
visit_merge_requests(project) visit_merge_requests(project)
filter_by_milestone(Milestone::Upcoming.title) filter_by_milestone(Milestone::Upcoming.title)
expect(page).to have_css('.merge-request-title', count: 0) expect(page).to have_css('.merge-request', count: 0)
end end
it 'should show issues in future' do it 'should show issues in future' 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