summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Eipert <leipert@gitlab.com>2018-08-02 13:48:59 +0200
committerLukas Eipert <leipert@gitlab.com>2018-08-02 13:48:59 +0200
commit86d29506d1aa6fdfc17d4f2f5a07c6fa22075f5a (patch)
tree49bad8e6adaa14deea703292d9e530c2203becfd
parent069b2a8e1ead257484125f4137d8519b43236135 (diff)
downloadgitlab-ce-86d29506d1aa6fdfc17d4f2f5a07c6fa22075f5a.tar.gz
remove unnecessary if clause and move logic to optional partial
-rw-r--r--app/views/projects/pipelines/_info.html.haml66
-rw-r--r--app/views/projects/pipelines/show.html.haml3
2 files changed, 35 insertions, 34 deletions
diff --git a/app/views/projects/pipelines/_info.html.haml b/app/views/projects/pipelines/_info.html.haml
index bb85cec1978..cdbef98df29 100644
--- a/app/views/projects/pipelines/_info.html.haml
+++ b/app/views/projects/pipelines/_info.html.haml
@@ -1,36 +1,38 @@
+- commit = local_assigns.fetch(:commit)
-- if @commit.present?
- .commit-box
- %h3.commit-title
- = markdown(@commit.title, pipeline: :single_line)
- - if @commit.description.present?
- .commit-description<
- = preserve(markdown(@commit.description, pipeline: :single_line))
+- return unless commit&.present?
- .info-well
- - if @commit.status
- .well-segment.pipeline-info
- .icon-container
- = icon('clock-o')
- = pluralize @pipeline.total_size, "job"
- - if @pipeline.ref
- from
- = link_to @pipeline.ref, project_ref_path(@project, @pipeline.ref), class: "ref-name"
- - if @pipeline.duration
- in
- = time_interval_in_words(@pipeline.duration)
- - if @pipeline.queued_duration
- = "(queued for #{time_interval_in_words(@pipeline.queued_duration)})"
+.commit-box
+ %h3.commit-title
+ = markdown(commit.title, pipeline: :single_line)
+ - if commit.description.present?
+ .commit-description<
+ = preserve(markdown(commit.description, pipeline: :single_line))
- .well-segment.branch-info
- .icon-container.commit-icon
- = custom_icon("icon_commit")
- = link_to @commit.short_id, project_commit_path(@project, @pipeline.sha), class: "commit-sha js-details-short"
- = link_to("#", class: "js-details-expand d-none d-sm-none d-md-inline") do
- %span.text-expander
- = sprite_icon('ellipsis_h', size: 12)
- %span.js-details-content.hide
- = link_to @pipeline.sha, project_commit_path(@project, @pipeline.sha), class: "commit-sha commit-hash-full"
- = clipboard_button(text: @pipeline.sha, title: "Copy commit SHA to clipboard")
+.info-well
+ - if commit.status
+ .well-segment.pipeline-info
+ .icon-container
+ = icon('clock-o')
+ = pluralize @pipeline.total_size, "job"
+ - if @pipeline.ref
+ from
+ = link_to @pipeline.ref, project_ref_path(@project, @pipeline.ref), class: "ref-name"
+ - if @pipeline.duration
+ in
+ = time_interval_in_words(@pipeline.duration)
+ - if @pipeline.queued_duration
+ = "(queued for #{time_interval_in_words(@pipeline.queued_duration)})"
- = render_if_exists "projects/pipelines/info_extension", pipeline: @pipeline
+ .well-segment.branch-info
+ .icon-container.commit-icon
+ = custom_icon("icon_commit")
+ = link_to commit.short_id, project_commit_path(@project, @pipeline.sha), class: "commit-sha js-details-short"
+ = link_to("#", class: "js-details-expand d-none d-sm-none d-md-inline") do
+ %span.text-expander
+ = sprite_icon('ellipsis_h', size: 12)
+ %span.js-details-content.hide
+ = link_to @pipeline.sha, project_commit_path(@project, @pipeline.sha), class: "commit-sha commit-hash-full"
+ = clipboard_button(text: @pipeline.sha, title: "Copy commit SHA to clipboard")
+
+ = render_if_exists "projects/pipelines/info_extension", pipeline: @pipeline
diff --git a/app/views/projects/pipelines/show.html.haml b/app/views/projects/pipelines/show.html.haml
index be4837346e2..4066e2c590d 100644
--- a/app/views/projects/pipelines/show.html.haml
+++ b/app/views/projects/pipelines/show.html.haml
@@ -7,8 +7,7 @@
#js-pipeline-header-vue.pipeline-header-container
- - if @commit
- = render "projects/pipelines/info"
+ = render "projects/pipelines/info", commit: @pipeline.commit
= render "projects/pipelines/with_tabs", pipeline: @pipeline