Commit 05fcfe6d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'mr-button-color' into 'master'

Change merge request button color based on CI status

Green button looks confusing when CI fails

Screenshots:

![ci-warn](https://gitlab.com/gitlab-org/gitlab-ce/uploads/f8166c9acf35f9d886f37f52f975acfb/ci-warn.png)
![ci-can](https://gitlab.com/gitlab-org/gitlab-ce/uploads/d7319c4c567c42a47d79953191384f96/ci-can.png)

See merge request !448
parents 2993e280 35ec08a6
...@@ -113,8 +113,14 @@ class @MergeRequest ...@@ -113,8 +113,14 @@ class @MergeRequest
allowed_states = ["failed", "canceled", "running", "pending", "success"] allowed_states = ["failed", "canceled", "running", "pending", "success"]
if state in allowed_states if state in allowed_states
$('.ci_widget.ci-' + state).show() $('.ci_widget.ci-' + state).show()
switch state
when "failed", "canceled"
@setMergeButtonClass('btn-danger')
when "running", "pending"
@setMergeButtonClass('btn-warning')
else else
$('.ci_widget.ci-error').show() $('.ci_widget.ci-error').show()
@setMergeButtonClass('btn-danger')
showCiCoverage: (coverage) -> showCiCoverage: (coverage) ->
cov_html = $('<span>') cov_html = $('<span>')
...@@ -144,6 +150,9 @@ class @MergeRequest ...@@ -144,6 +150,9 @@ class @MergeRequest
this.$('.merge-in-progress').hide() this.$('.merge-in-progress').hide()
this.$('.automerge_widget.already_cannot_be_merged').show() this.$('.automerge_widget.already_cannot_be_merged').show()
setMergeButtonClass: (css_class) ->
$('.accept_merge_request').removeClass("btn-create").addClass(css_class)
mergeInProgress: -> mergeInProgress: ->
$.ajax $.ajax
type: 'GET' type: 'GET'
......
...@@ -137,30 +137,15 @@ ...@@ -137,30 +137,15 @@
background-color: #F1FAF1; background-color: #F1FAF1;
} }
&.ci-pending { &.ci-pending,
color: #548;
border-color: #548;
background-color: #F4F1FA;
}
&.ci-running { &.ci-running {
color: $gl-warning; color: $gl-warning;
border-color: $gl-warning; border-color: $gl-warning;
background-color: #FAF5F1; background-color: #FAF5F1;
} }
&.ci-failed { &.ci-failed,
color: $gl-danger; &.ci-canceled,
border-color: $gl-danger;
background-color: #FAF1F1;
}
&.ci-canceled {
color: $gl-warning;
border-color: $gl-danger;
background-color: #FAF5F1;
}
&.ci-error { &.ci-error {
color: $gl-danger; color: $gl-danger;
border-color: $gl-danger; border-color: $gl-danger;
......
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