From c96e037dcbe127c6525058a7884fc7c5f2708979 Mon Sep 17 00:00:00 2001
From: Kamil Trzcinski <ayufan@ayufan.eu>
Date: Tue, 15 Mar 2016 14:26:15 +0100
Subject: [PATCH] Fix double borders around the CI status

---
 app/helpers/ci_status_helper.rb                        | 10 +++++++---
 app/views/projects/ci/builds/_build.html.haml          |  3 +--
 .../_generic_commit_status.html.haml                   |  3 +--
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb
index f20779f2fb..391d74ebdb 100644
--- a/app/helpers/ci_status_helper.rb
+++ b/app/helpers/ci_status_helper.rb
@@ -12,9 +12,13 @@ module CiStatusHelper
     ci_label_for_status(ci_commit.status)
   end
 
-  def ci_status_with_icon(status)
-    content_tag :span, class: "ci-status ci-#{status}" do
-      ci_icon_for_status(status) + '&nbsp;'.html_safe + ci_label_for_status(status)
+  def ci_status_with_icon(status, target = nil)
+    content = ci_icon_for_status(status) + '&nbsp;'.html_safe + ci_label_for_status(status)
+    clazz = "ci-status ci-#{status}"
+    if target
+      link_to content, target, class: clazz
+    else
+      content_tag :span, content, class: clazz
     end
   end
 
diff --git a/app/views/projects/ci/builds/_build.html.haml b/app/views/projects/ci/builds/_build.html.haml
index 7123efffd5..d22d1da840 100644
--- a/app/views/projects/ci/builds/_build.html.haml
+++ b/app/views/projects/ci/builds/_build.html.haml
@@ -1,8 +1,7 @@
 %tr.build
   %td.status
     - if can?(current_user, :read_build, build)
-      = link_to namespace_project_build_url(build.project.namespace, build.project, build), class: "ci-status ci-#{build.status}" do
-        = ci_status_with_icon(build.status)
+      = ci_status_with_icon(build.status, namespace_project_build_url(build.project.namespace, build.project, build))
     - else
       = ci_status_with_icon(build.status)
 
diff --git a/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml b/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml
index 4143ea1306..c15386b488 100644
--- a/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml
+++ b/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml
@@ -1,8 +1,7 @@
 %tr.generic_commit_status
   %td.status
     - if can?(current_user, :read_commit_status, generic_commit_status) && generic_commit_status.target_url
-      = link_to generic_commit_status.target_url, class: "ci-status ci-#{generic_commit_status.status}" do
-        = ci_status_with_icon(generic_commit_status.status)
+      = ci_status_with_icon(generic_commit_status.status, generic_commit_status.target_url)
     - else
       = ci_status_with_icon(generic_commit_status.status)
 
-- 
2.30.9