Browse files

Add status badge for MR

  • Loading branch information...
1 parent ed92cfd commit ebcbe0c87b12d10c40c6a3fa13ceec02e8220090 @randx randx committed Nov 20, 2012
View
5 app/assets/stylesheets/sections/merge_requests.scss
@@ -138,3 +138,8 @@ li.merge_request {
}
}
+.status-badge {
+ height: 32px;
+ width: 100%;
+ @include border-radius(5px);
+}
View
4 app/helpers/merge_requests_helper.rb
@@ -38,4 +38,8 @@ def mr_css_classes mr
classes << " merged" if mr.merged?
classes
end
+
+ def ci_status_path
+ @project.gitlab_ci_service.commit_badge_path(@merge_request.last_commit.sha)
+ end
end
View
4 app/models/gitlab_ci_service.rb
@@ -32,4 +32,8 @@ def compose_service_hook
hook.url = [project_url, "/build", "?token=#{token}"].join("")
hook.save
end
+
+ def commit_badge_path sha
+ project_url + "/status?sha=#{sha}"
+ end
end
View
4 app/models/project.rb
@@ -188,4 +188,8 @@ def issues_labels
def services
[gitlab_ci_service].compact
end
+
+ def gitlab_ci?
+ gitlab_ci_service && gitlab_ci_service.active
+ end
end
View
3 app/views/merge_requests/show/_mr_box.html.haml
@@ -6,6 +6,9 @@
- else
.alert-message.success.status_info Open
= gfm escape_once(@merge_request.title)
+ - if @project.gitlab_ci?
+ .right
+ = image_tag ci_status_path, class: 'status-badge'
.middle_box_content
%div

0 comments on commit ebcbe0c

Please sign in to comment.