Commit 725dae25 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'fix-group-milestone-link-in-issuable-sidebar' into 'master'

Fix group milestone path on issuable sidebar

See merge request !13199
parents f3b21d57 15911ef3
...@@ -48,7 +48,11 @@ module GitlabRoutingHelper ...@@ -48,7 +48,11 @@ module GitlabRoutingHelper
end end
def milestone_path(entity, *args) def milestone_path(entity, *args)
project_milestone_path(entity.project, entity, *args) if entity.is_group_milestone?
group_milestone_path(entity.group, entity, *args)
elsif entity.is_project_milestone?
project_milestone_path(entity.project, entity, *args)
end
end end
def issue_url(entity, *args) def issue_url(entity, *args)
...@@ -63,6 +67,14 @@ module GitlabRoutingHelper ...@@ -63,6 +67,14 @@ module GitlabRoutingHelper
project_pipeline_url(pipeline.project, pipeline.id, *args) project_pipeline_url(pipeline.project, pipeline.id, *args)
end end
def milestone_url(entity, *args)
if entity.is_group_milestone?
group_milestone_url(entity.group, entity, *args)
elsif entity.is_project_milestone?
project_milestone_url(entity.project, entity, *args)
end
end
def pipeline_job_url(pipeline, build, *args) def pipeline_job_url(pipeline, build, *args)
project_job_url(pipeline.project, build.id, *args) project_job_url(pipeline.project, build.id, *args)
end end
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
= link_to 'Edit', '#', class: 'edit-link pull-right' = link_to 'Edit', '#', class: 'edit-link pull-right'
.value.hide-collapsed .value.hide-collapsed
- if issuable.milestone - if issuable.milestone
= link_to issuable.milestone.title, project_milestone_path(@project, issuable.milestone), class: "bold has-tooltip", title: milestone_remaining_days(issuable.milestone), data: { container: "body", html: 1 } = link_to issuable.milestone.title, milestone_path(issuable.milestone), class: "bold has-tooltip", title: milestone_remaining_days(issuable.milestone), data: { container: "body", html: 1 }
- else - else
%span.no-value None %span.no-value None
......
---
title: Fix links to group milestones from issue and merge request sidebar
merge_request:
author:
...@@ -17,7 +17,7 @@ FactoryGirl.define do ...@@ -17,7 +17,7 @@ FactoryGirl.define do
state "closed" state "closed"
end end
after(:build) do |milestone, evaluator| after(:build, :stub) do |milestone, evaluator|
if evaluator.group if evaluator.group
milestone.group = evaluator.group milestone.group = evaluator.group
elsif evaluator.group_id elsif evaluator.group_id
......
require 'spec_helper' require 'spec_helper'
describe GitlabRoutingHelper do describe GitlabRoutingHelper do
let(:project) { build_stubbed(:empty_project) }
let(:group) { build_stubbed(:group) }
describe 'Project URL helpers' do describe 'Project URL helpers' do
describe '#project_member_path' do describe '#project_member_path' do
let(:project_member) { create(:project_member) } let(:project_member) { create(:project_member) }
...@@ -9,14 +12,10 @@ describe GitlabRoutingHelper do ...@@ -9,14 +12,10 @@ describe GitlabRoutingHelper do
end end
describe '#request_access_project_members_path' do describe '#request_access_project_members_path' do
let(:project) { build_stubbed(:empty_project) }
it { expect(request_access_project_members_path(project)).to eq request_access_project_project_members_path(project) } it { expect(request_access_project_members_path(project)).to eq request_access_project_project_members_path(project) }
end end
describe '#leave_project_members_path' do describe '#leave_project_members_path' do
let(:project) { build_stubbed(:empty_project) }
it { expect(leave_project_members_path(project)).to eq leave_project_project_members_path(project) } it { expect(leave_project_members_path(project)).to eq leave_project_project_members_path(project) }
end end
...@@ -35,8 +34,6 @@ describe GitlabRoutingHelper do ...@@ -35,8 +34,6 @@ describe GitlabRoutingHelper do
describe 'Group URL helpers' do describe 'Group URL helpers' do
describe '#group_members_url' do describe '#group_members_url' do
let(:group) { build_stubbed(:group) }
it { expect(group_members_url(group)).to eq group_group_members_url(group) } it { expect(group_members_url(group)).to eq group_group_members_url(group) }
end end
...@@ -47,14 +44,10 @@ describe GitlabRoutingHelper do ...@@ -47,14 +44,10 @@ describe GitlabRoutingHelper do
end end
describe '#request_access_group_members_path' do describe '#request_access_group_members_path' do
let(:group) { build_stubbed(:group) }
it { expect(request_access_group_members_path(group)).to eq request_access_group_group_members_path(group) } it { expect(request_access_group_members_path(group)).to eq request_access_group_group_members_path(group) }
end end
describe '#leave_group_members_path' do describe '#leave_group_members_path' do
let(:group) { build_stubbed(:group) }
it { expect(leave_group_members_path(group)).to eq leave_group_group_members_path(group) } it { expect(leave_group_members_path(group)).to eq leave_group_group_members_path(group) }
end end
...@@ -70,4 +63,44 @@ describe GitlabRoutingHelper do ...@@ -70,4 +63,44 @@ describe GitlabRoutingHelper do
it { expect(resend_invite_group_member_path(group_member)).to eq resend_invite_group_group_member_path(group_member.source, group_member) } it { expect(resend_invite_group_member_path(group_member)).to eq resend_invite_group_group_member_path(group_member.source, group_member) }
end end
end end
describe '#milestone_path' do
context 'for a group milestone' do
let(:milestone) { build_stubbed(:milestone, group: group, iid: 1) }
it 'links to the group milestone page' do
expect(milestone_path(milestone))
.to eq(group_milestone_path(group, milestone))
end
end
context 'for a project milestone' do
let(:milestone) { build_stubbed(:milestone, project: project, iid: 1) }
it 'links to the project milestone page' do
expect(milestone_path(milestone))
.to eq(project_milestone_path(project, milestone))
end
end
end
describe '#milestone_url' do
context 'for a group milestone' do
let(:milestone) { build_stubbed(:milestone, group: group, iid: 1) }
it 'links to the group milestone page' do
expect(milestone_url(milestone))
.to eq(group_milestone_url(group, milestone))
end
end
context 'for a project milestone' do
let(:milestone) { build_stubbed(:milestone, project: project, iid: 1) }
it 'links to the project milestone page' do
expect(milestone_url(milestone))
.to eq(project_milestone_url(project, milestone))
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