Commit 1008fad1 authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Jose Ivan Vargas

Merge branch '36430-edit-milestone-link' into 'master'

Fix edit milestone path from group milestones list

Closes #36430

See merge request !13581
parent 97669898
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
.col-sm-6.milestone-actions .col-sm-6.milestone-actions
- if can?(current_user, :admin_milestones, @group) - if can?(current_user, :admin_milestones, @group)
- if milestone.is_group_milestone? - if milestone.is_group_milestone?
= link_to edit_group_milestone_path(@group, milestone.id), class: "btn btn-xs btn-grouped" do = link_to edit_group_milestone_path(@group, milestone), class: "btn btn-xs btn-grouped" do
Edit Edit
\ \
- if milestone.closed? - if milestone.closed?
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
.pull-right .pull-right
- if can?(current_user, :admin_milestones, group) - if can?(current_user, :admin_milestones, group)
- if milestone.is_group_milestone? - if milestone.is_group_milestone?
= link_to edit_group_milestone_path(group, milestone.iid), class: "btn btn btn-grouped" do = link_to edit_group_milestone_path(group, milestone), class: "btn btn btn-grouped" do
Edit Edit
- if milestone.active? - if milestone.active?
= link_to 'Close Milestone', group_milestone_route(milestone, {state_event: :close }), method: :put, class: "btn btn-grouped btn-close" = link_to 'Close Milestone', group_milestone_route(milestone, {state_event: :close }), method: :put, class: "btn btn-grouped btn-close"
......
...@@ -37,12 +37,12 @@ feature 'Group milestones', :js do ...@@ -37,12 +37,12 @@ feature 'Group milestones', :js do
context 'milestones list' do context 'milestones list' do
let!(:other_project) { create(:project_empty_repo, group: group) } let!(:other_project) { create(:project_empty_repo, group: group) }
let!(:active_group_milestone) { create(:milestone, group: group, state: 'active') }
let!(:active_project_milestone1) { create(:milestone, project: project, state: 'active', title: 'v1.0') } let!(:active_project_milestone1) { create(:milestone, project: project, state: 'active', title: 'v1.0') }
let!(:active_project_milestone2) { create(:milestone, project: other_project, state: 'active', title: 'v1.0') } let!(:active_project_milestone2) { create(:milestone, project: other_project, state: 'active', title: 'v1.0') }
let!(:closed_group_milestone) { create(:milestone, group: group, state: 'closed') }
let!(:closed_project_milestone1) { create(:milestone, project: project, state: 'closed', title: 'v2.0') } let!(:closed_project_milestone1) { create(:milestone, project: project, state: 'closed', title: 'v2.0') }
let!(:closed_project_milestone2) { create(:milestone, project: other_project, state: 'closed', title: 'v2.0') } let!(:closed_project_milestone2) { create(:milestone, project: other_project, state: 'closed', title: 'v2.0') }
let!(:active_group_milestone) { create(:milestone, group: group, state: 'active') }
let!(:closed_group_milestone) { create(:milestone, group: group, state: 'closed') }
before do before do
visit group_milestones_path(group) visit group_milestones_path(group)
...@@ -60,5 +60,30 @@ feature 'Group milestones', :js do ...@@ -60,5 +60,30 @@ feature 'Group milestones', :js do
expect(page).to have_selector("#milestone_#{active_group_milestone.id}", count: 1) expect(page).to have_selector("#milestone_#{active_group_milestone.id}", count: 1)
expect(page).to have_selector("#milestone_#{legacy_milestone.milestones.first.id}", count: 1) expect(page).to have_selector("#milestone_#{legacy_milestone.milestones.first.id}", count: 1)
end end
it 'updates milestone' do
page.within(".milestones #milestone_#{active_group_milestone.id}") do
click_link('Edit')
end
page.within('.milestone-form') do
fill_in 'milestone_title', with: 'new title'
click_button('Update milestone')
end
expect(find('#content-body h2')).to have_content('new title')
end
it 'shows milestone detail and supports its edit' do
page.within(".milestones #milestone_#{active_group_milestone.id}") do
click_link(active_group_milestone.title)
end
page.within('.detail-page-header') do
click_link('Edit')
end
expect(page).to have_selector('.milestone-form')
end
end end
end end
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