Move rendering CI status to helper

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2015-10-23 17:32:52 +02:00
parent 7b06c83cf7
commit 696a708401
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
4 changed files with 10 additions and 8 deletions

View file

@ -42,4 +42,11 @@ module CiStatusHelper
icon(icon_name)
end
def render_ci_status(ci_commit)
link_to ci_status_path(ci_commit), class: "c#{ci_status_color(ci_commit)}",
title: "Build status: #{ci_commit.status}", data: {toggle: 'tooltip', placement: 'left'} do
ci_status_icon(ci_commit)
end
end
end

View file

@ -18,8 +18,7 @@
.pull-right
- if ci_commit
= link_to ci_status_path(ci_commit), class: "c#{ci_status_color(ci_commit)}" do
= ci_status_icon(ci_commit)
= render_ci_status(ci_commit)
&nbsp;
= link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id"

View file

@ -8,9 +8,7 @@
= link_to_label(label, project: merge_request.project)
.pull-right.light
- if ci_commit
= link_to ci_status_path(ci_commit), class: "c#{ci_status_color(ci_commit)}",
title: "Build status: #{ci_commit.status}", data: {toggle: 'tooltip', placement: 'left'} do
= ci_status_icon(ci_commit)
= render_ci_status(ci_commit)
- if merge_request.merged?
%span
%i.fa.fa-check

View file

@ -21,9 +21,7 @@
.project-controls
- if ci && !project.empty_repo? && project.commit
- if ci_commit = project.ci_commit(project.commit.sha)
= link_to ci_status_path(ci_commit), class: "c#{ci_status_color(ci_commit)}",
title: "Build status: #{ci_commit.status}", data: {toggle: 'tooltip', placement: 'left'} do
= ci_status_icon(ci_commit)
= render_ci_status(ci_commit)
&nbsp;
- if stars
%span