diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-11-18 18:49:19 +0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-11-18 23:33:30 +0300 |
commit | e1149fdb63772c13716f2dcaf3cf65a868a12773 (patch) | |
tree | 19743428b0f7dfdc4e83ab6d91b6062ef378d14e /app/helpers | |
parent | 2e5ff7788706dd84d275745f4629ad53301a9854 (diff) |
Merge branch '23205-information-about-environments-build-page' into 'master'
Add environment info to builds page
![Screen_Shot_2016-11-02_at_5.44.01_PM](/uploads/3443d9518997147d1e6f41830e3774ff/Screen_Shot_2016-11-02_at_5.44.01_PM.png)
Closes #23205
See merge request !7251
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/environment_helper.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/helpers/environment_helper.rb b/app/helpers/environment_helper.rb new file mode 100644 index 00000000000..27975b7ddb7 --- /dev/null +++ b/app/helpers/environment_helper.rb @@ -0,0 +1,29 @@ +module EnvironmentHelper + def environment_for_build(project, build) + return unless build.environment + + project.environments.find_by(name: build.expanded_environment_name) + end + + def environment_link_for_build(project, build) + environment = environment_for_build(project, build) + if environment + link_to environment.name, namespace_project_environment_path(project.namespace, project, environment) + else + content_tag :span, build.expanded_environment_name + end + end + + def deployment_link(deployment) + return unless deployment + + link_to "##{deployment.iid}", [deployment.project.namespace.becomes(Namespace), deployment.project, deployment.deployable] + end + + def last_deployment_link_for_environment_build(project, build) + environment = environment_for_build(project, build) + return unless environment + + deployment_link(environment.last_deployment) + end +end |