Commit ebcbe0c8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add status badge for MR

parent ed92cfde
...@@ -138,3 +138,8 @@ li.merge_request { ...@@ -138,3 +138,8 @@ li.merge_request {
} }
} }
.status-badge {
height: 32px;
width: 100%;
@include border-radius(5px);
}
...@@ -38,4 +38,8 @@ module MergeRequestsHelper ...@@ -38,4 +38,8 @@ module MergeRequestsHelper
classes << " merged" if mr.merged? classes << " merged" if mr.merged?
classes classes
end end
def ci_status_path
@project.gitlab_ci_service.commit_badge_path(@merge_request.last_commit.sha)
end
end end
...@@ -32,4 +32,8 @@ class GitlabCiService < Service ...@@ -32,4 +32,8 @@ class GitlabCiService < Service
hook.url = [project_url, "/build", "?token=#{token}"].join("") hook.url = [project_url, "/build", "?token=#{token}"].join("")
hook.save hook.save
end end
def commit_badge_path sha
project_url + "/status?sha=#{sha}"
end
end end
...@@ -188,4 +188,8 @@ class Project < ActiveRecord::Base ...@@ -188,4 +188,8 @@ class Project < ActiveRecord::Base
def services def services
[gitlab_ci_service].compact [gitlab_ci_service].compact
end end
def gitlab_ci?
gitlab_ci_service && gitlab_ci_service.active
end
end end
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
- else - else
.alert-message.success.status_info Open .alert-message.success.status_info Open
= gfm escape_once(@merge_request.title) = gfm escape_once(@merge_request.title)
- if @project.gitlab_ci?
.right
= image_tag ci_status_path, class: 'status-badge'
.middle_box_content .middle_box_content
%div %div
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment