diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-11-22 01:12:19 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-11-22 01:12:19 +0800 |
commit | 438f0915e7fbd60e6cc597656e9b25284c52f7de (patch) | |
tree | c63c79b592ac10582b8dfbea68003505e26a9f8b | |
parent | bf8c7dc3b13ba3661e2c2d43fa107f6c3496b3b2 (diff) | |
download | gitlab-ce-438f0915e7fbd60e6cc597656e9b25284c52f7de.tar.gz |
Use partials instead of simple switch case:
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7617#note_18745137
6 files changed, 7 insertions, 7 deletions
diff --git a/app/views/notify/ci/builds/_build.html.haml b/app/views/notify/ci/builds/_build.html.haml new file mode 100644 index 00000000000..38cd4e5e145 --- /dev/null +++ b/app/views/notify/ci/builds/_build.html.haml @@ -0,0 +1,2 @@ +%a{href: pipeline_build_url(pipeline, build), style: "color:#3777b0;text-decoration:none;"} + = build.name diff --git a/app/views/notify/ci/builds/_build.text.erb b/app/views/notify/ci/builds/_build.text.erb new file mode 100644 index 00000000000..d510de3dbe9 --- /dev/null +++ b/app/views/notify/ci/builds/_build.text.erb @@ -0,0 +1 @@ +Build #<%= build.id %> ( <%= pipeline_build_url(@pipeline, build) %> ) diff --git a/app/views/notify/generic_commit_statuses/_generic_commit_status.html.haml b/app/views/notify/generic_commit_statuses/_generic_commit_status.html.haml new file mode 100644 index 00000000000..b6563b185b3 --- /dev/null +++ b/app/views/notify/generic_commit_statuses/_generic_commit_status.html.haml @@ -0,0 +1 @@ += build.name diff --git a/app/views/notify/generic_commit_statuses/_generic_commit_status.text.erb b/app/views/notify/generic_commit_statuses/_generic_commit_status.text.erb new file mode 100644 index 00000000000..8e89c52a1f3 --- /dev/null +++ b/app/views/notify/generic_commit_statuses/_generic_commit_status.text.erb @@ -0,0 +1 @@ +Build #<%= build.id %> diff --git a/app/views/notify/pipeline_failed_email.html.haml b/app/views/notify/pipeline_failed_email.html.haml index 72825e7a7e1..58d331acb33 100644 --- a/app/views/notify/pipeline_failed_email.html.haml +++ b/app/views/notify/pipeline_failed_email.html.haml @@ -158,12 +158,7 @@ %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;color:#8c8c8c;font-weight:500;font-size:15px;vertical-align:middle;"} = build.stage %td{align: "right", style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:20px 0;color:#8c8c8c;font-weight:500;font-size:15px;"} - - case build - - when Ci::Build - %a{href: pipeline_build_url(@pipeline, build), style: "color:#3777b0;text-decoration:none;"} - = build.name - - when GenericCommitStatus - = build.name + = render "notify/#{build.to_partial_path}", pipeline: @pipeline, build: build %tr.build-log - if build.has_trace? %td{colspan: "2", style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:0 0 15px;"} diff --git a/app/views/notify/pipeline_failed_email.text.erb b/app/views/notify/pipeline_failed_email.text.erb index d4c03c01bc7..ddb21cc17e8 100644 --- a/app/views/notify/pipeline_failed_email.text.erb +++ b/app/views/notify/pipeline_failed_email.text.erb @@ -19,7 +19,7 @@ Commit Author: <%= commit.author_name %> Pipeline #<%= @pipeline.id %> ( <%= pipeline_url(@pipeline) %> ) had <%= failed.size %> failed <%= 'build'.pluralize(failed.size) %>. <% failed.each do |build| -%> -Build #<%= build.id %><%= if build.kind_of?(Ci::Build) then " ( #{pipeline_build_url(@pipeline, build)} )" end %> +<%= render "notify/#{build.to_partial_path}", pipeline: @pipeline, build: build %> Stage: <%= build.stage %> Name: <%= build.name %> <% if build.has_trace? -%> |