summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-08-03 12:50:06 +0100
committerSean McGivern <sean@gitlab.com>2017-08-07 11:55:00 +0100
commit149528f472f3d2f3865ae01c764b81c6a97f9380 (patch)
tree8c9e38e7071b0a0002d3741259a7318e7a0427e5 /app/helpers
parent03b816f3e845c9b25d3588336fc1616238465deb (diff)
downloadgitlab-ce-149528f472f3d2f3865ae01c764b81c6a97f9380.tar.gz
Support references to group milestones
Group milestones can only be referred to by name, not IID. They also do not support cross-project references.
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/gitlab_routing_helper.rb16
-rw-r--r--app/helpers/milestones_routing_helper.rb17
2 files changed, 17 insertions, 16 deletions
diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb
index 1f7db9b2eb8..d4a91e533c1 100644
--- a/app/helpers/gitlab_routing_helper.rb
+++ b/app/helpers/gitlab_routing_helper.rb
@@ -47,14 +47,6 @@ module GitlabRoutingHelper
project_pipeline_path(pipeline.project, pipeline.id, *args)
end
- def milestone_path(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
-
def issue_url(entity, *args)
project_issue_url(entity.project, entity, *args)
end
@@ -67,14 +59,6 @@ module GitlabRoutingHelper
project_pipeline_url(pipeline.project, pipeline.id, *args)
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)
project_job_url(pipeline.project, build.id, *args)
end
diff --git a/app/helpers/milestones_routing_helper.rb b/app/helpers/milestones_routing_helper.rb
new file mode 100644
index 00000000000..766d5262018
--- /dev/null
+++ b/app/helpers/milestones_routing_helper.rb
@@ -0,0 +1,17 @@
+module MilestonesRoutingHelper
+ def milestone_path(milestone, *args)
+ if milestone.is_group_milestone?
+ group_milestone_path(milestone.group, milestone, *args)
+ elsif milestone.is_project_milestone?
+ project_milestone_path(milestone.project, milestone, *args)
+ end
+ end
+
+ def milestone_url(milestone, *args)
+ if milestone.is_group_milestone?
+ group_milestone_url(milestone.group, milestone, *args)
+ elsif milestone.is_project_milestone?
+ project_milestone_url(milestone.project, milestone, *args)
+ end
+ end
+end