summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2016-12-14 08:33:05 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2016-12-14 08:33:05 +0000
commitc6d7785976bf84518e098cc168847e3e4e7e6386 (patch)
tree5c9d86562444be0e58f65cd163b6dd92e6176b3c /app
parent3e8118d689824ef299c1069eff6150849046c0b5 (diff)
parent4eb53036c7469d027d2a75aff9e70950557195d2 (diff)
downloadgitlab-ce-c6d7785976bf84518e098cc168847e3e4e7e6386.tar.gz
Merge branch '25136-last-deployment-link' into 'master'
Fix broken link for latest deployment ## What does this MR do? Creates a new helper for the latest deployment link. ## Why was this MR needed? A helper that returns a link was being called inside another helper that creates a link, resulting in `builds/<a href="builds/ID>#id</a>` ## What are the relevant issue numbers? Closes #25136 See merge request !7839
Diffstat (limited to 'app')
-rw-r--r--app/helpers/environment_helper.rb6
-rw-r--r--app/views/projects/builds/show.html.haml3
2 files changed, 5 insertions, 4 deletions
diff --git a/app/helpers/environment_helper.rb b/app/helpers/environment_helper.rb
index 27975b7ddb7..ff8550439d0 100644
--- a/app/helpers/environment_helper.rb
+++ b/app/helpers/environment_helper.rb
@@ -14,10 +14,12 @@ module EnvironmentHelper
end
end
- def deployment_link(deployment)
+ def deployment_link(deployment, text: nil)
return unless deployment
- link_to "##{deployment.iid}", [deployment.project.namespace.becomes(Namespace), deployment.project, deployment.deployable]
+ link_label = text ? text : "##{deployment.iid}"
+
+ link_to link_label, [deployment.project.namespace.becomes(Namespace), deployment.project, deployment.deployable]
end
def last_deployment_link_for_environment_build(project, build)
diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml
index 108674dbba6..cdeb81372ee 100644
--- a/app/views/projects/builds/show.html.haml
+++ b/app/views/projects/builds/show.html.haml
@@ -46,8 +46,7 @@
- else
This build is creating a deployment to #{environment_link_for_build(@build.project, @build)}
- if environment.try(:last_deployment)
- and will overwrite the
- = link_to 'latest deployment', deployment_link(environment.last_deployment)
+ and will overwrite the #{deployment_link(environment.last_deployment, text: 'latest deployment')}
.prepend-top-default
- if @build.erased?