Commit f4c9d514 authored by Phil Hughes's avatar Phil Hughes

Defaults milestone filter to upcoming

parent 917a5140
......@@ -7,7 +7,7 @@
this.state.filters = {
author_id: gl.utils.getParameterValues('author_id')[0],
assignee_id: gl.utils.getParameterValues('assignee_id')[0],
milestone_title: gl.utils.getParameterValues('milestone_title')[0],
milestone_title: gl.utils.getParameterValues('milestone_title')[0] || '#upcoming',
label_name: gl.utils.getParameterValues('label_name[]')
};
},
......
......@@ -88,7 +88,7 @@
var dragInterval = setInterval(function loop() {
var progress = (new Date().getTime() - startTime) / duration;
var x = (fromRect.cx + (toRect.cx - fromRect.cx) * progress) - scrollable.scrollLeft;
var y = (fromRect.cy + (toRect.cy - fromRect.cy) * progress) - scrollable.scrollTop;
var y = (fromRect.cy + (toRect.cy - fromRect.cy) * progress) - scrollable.scrollTop;
var overEl = fromEl.ownerDocument.elementFromPoint(x, y);
simulateEvent(overEl, 'mousemove', {
......
......@@ -228,6 +228,7 @@
.board-list {
-webkit-flex: 1;
flex: 1;
height: 400px;
margin-bottom: 0;
padding: 5px;
overflow-y: scroll;
......
......@@ -49,12 +49,16 @@ module IssuablesHelper
end
end
def milestone_dropdown_label(milestone_title, default_label = "Milestone")
def milestone_dropdown_label(milestone_title, is_boards, default_label = "Milestone")
if milestone_title == Milestone::Upcoming.name
milestone_title = Milestone::Upcoming.title
end
h(milestone_title.presence || default_label)
if is_boards
boards_default = Milestone::Upcoming.title
end
h(milestone_title.presence || boards_default || default_label)
end
def issuable_meta(issuable, project, text)
......
......@@ -4,7 +4,7 @@
- content_for :page_specific_javascripts do
= page_specific_javascript_tag('boards/boards_bundle.js')
= page_specific_javascript_tag('boards/test_utils/simulate_drag.js') if Rails.env.test?
= page_specific_javascript_tag('boards/test_utils/simulate_drag.js')
= render "projects/issues/head"
......
- is_boards = controller.controller_name == 'boards'
- if params[:milestone_title].present?
= hidden_field_tag(:milestone_title, params[:milestone_title])
= 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",
- elsif is_boards
= hidden_field_tag(:milestone_title, Milestone::Upcoming.name)
= dropdown_tag(milestone_dropdown_label(params[:milestone_title], is_boards), 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
- if @project
%ul.dropdown-footer-list
......
......@@ -44,7 +44,8 @@ describe 'Issue Boards', feature: true, js: true do
end
context 'with lists' do
let(:milestone) { create(:milestone, project: project) }
let!(:milestone_upcoming) { create(:milestone, project: project, due_date: Date.tomorrow) }
let(:milestone) { create(:milestone, project: project) }
let(:planning) { create(:label, project: project, name: 'Planning') }
let(:development) { create(:label, project: project, name: 'Development') }
......@@ -54,16 +55,16 @@ describe 'Issue Boards', feature: true, js: true do
let!(:list1) { create(:list, board: project.board, label: planning, position: 0) }
let!(:list2) { create(:list, board: project.board, label: development, position: 1) }
let!(:confidential_issue) { create(:issue, :confidential, project: project, author: user) }
let!(:issue1) { create(:issue, project: project, assignee: user) }
let!(:issue2) { create(:issue, project: project, author: user2) }
let!(:issue3) { create(:issue, project: project) }
let!(:issue4) { create(:issue, project: project) }
let!(:confidential_issue) { create(:issue, :confidential, project: project, author: user, milestone: milestone_upcoming) }
let!(:issue1) { create(:issue, project: project, assignee: user, milestone: milestone_upcoming) }
let!(:issue2) { create(:issue, project: project, author: user2, milestone: milestone_upcoming) }
let!(:issue3) { create(:issue, project: project, milestone: milestone_upcoming) }
let!(:issue4) { create(:issue, project: project, milestone: milestone_upcoming) }
let!(:issue5) { create(:labeled_issue, project: project, labels: [planning], milestone: milestone) }
let!(:issue6) { create(:labeled_issue, project: project, labels: [planning, development]) }
let!(:issue7) { create(:labeled_issue, project: project, labels: [development]) }
let!(:issue8) { create(:closed_issue, project: project) }
let!(:issue9) { create(:labeled_issue, project: project, labels: [testing, bug]) }
let!(:issue6) { create(:labeled_issue, project: project, labels: [planning, development], milestone: milestone_upcoming) }
let!(:issue7) { create(:labeled_issue, project: project, labels: [development], milestone: milestone_upcoming) }
let!(:issue8) { create(:closed_issue, project: project, milestone: milestone_upcoming) }
let!(:issue9) { create(:labeled_issue, project: project, labels: [testing, bug], milestone: milestone_upcoming) }
before do
visit namespace_project_board_path(project.namespace, project)
......@@ -77,8 +78,8 @@ describe 'Issue Boards', feature: true, js: true do
it 'shows issues in lists' do
page.within(all('.board')[1]) do
expect(page.find('.board-header')).to have_content('2')
expect(page).to have_selector('.card', count: 2)
expect(page.find('.board-header')).to have_content('1')
expect(page).to have_selector('.card', count: 1)
end
page.within(all('.board')[2]) do
......@@ -102,7 +103,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'infinite scrolls list' do
50.times do
create(:issue, project: project)
create(:issue, project: project, milestone: milestone_upcoming)
end
visit namespace_project_board_path(project.namespace, project)
......@@ -156,8 +157,8 @@ describe 'Issue Boards', feature: true, js: true do
end
page.within(all('.board')[1]) do
expect(page.find('.board-header')).to have_content('3')
expect(page).to have_selector('.card', count: 3)
expect(page.find('.board-header')).to have_content('2')
expect(page).to have_selector('.card', count: 2)
end
end
end
......@@ -178,7 +179,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'removes all of the same issue to done' do
drag_to(list_from_index: 1, list_to_index: 3)
expect(all('.board')[1]).to have_selector('.card', count: 1)
expect(all('.board')[1]).to have_selector('.card', count: 0)
expect(all('.board')[2]).to have_selector('.card', count: 1)
expect(all('.board').last).to have_content(issue6.title)
expect(all('.board').last).not_to have_content(planning.title)
......@@ -194,10 +195,10 @@ describe 'Issue Boards', feature: true, js: true do
end
it 'moves between lists' do
drag_to(list_from_index: 1, card_index: 1, list_to_index: 2)
drag_to(list_from_index: 1, list_to_index: 2)
expect(all('.board')[1]).to have_selector('.card', count: 1)
expect(all('.board')[2]).to have_selector('.card', count: 3)
expect(all('.board')[1]).to have_selector('.card', count: 0)
expect(all('.board')[2]).to have_selector('.card', count: 2)
expect(all('.board')[2]).to have_content(issue6.title)
expect(all('.board')[2].all('.card').last).not_to have_content(development.title)
end
......@@ -205,7 +206,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'moves between lists' do
drag_to(list_from_index: 2, list_to_index: 1)
expect(all('.board')[1]).to have_selector('.card', count: 3)
expect(all('.board')[1]).to have_selector('.card', count: 2)
expect(all('.board')[2]).to have_selector('.card', count: 1)
expect(all('.board')[1]).to have_content(issue7.title)
expect(all('.board')[1].all('.card').first).not_to have_content(planning.title)
......@@ -214,7 +215,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'moves from done' do
drag_to(list_from_index: 3, list_to_index: 1)
expect(all('.board')[1]).to have_selector('.card', count: 3)
expect(all('.board')[1]).to have_selector('.card', count: 2)
expect(all('.board')[1]).to have_content(issue8.title)
end
......@@ -314,7 +315,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'filters by milestone' do
page.within '.issues-filters' do
click_button('Milestone')
click_button('Upcoming')
page.within '.milestone-filter' do
click_link(milestone.title)
......@@ -357,7 +358,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'infinite scrolls list with label filter' do
50.times do
create(:labeled_issue, project: project, labels: [testing])
create(:labeled_issue, project: project, labels: [testing], milestone: milestone_upcoming)
end
page.within '.issues-filters' 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