Style CI project/build list

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2015-09-18 09:44:10 +02:00
parent 0aec0d53b1
commit e86668984f
No known key found for this signature in database
GPG key ID: 161B5D6A44D3D88A
11 changed files with 21 additions and 46 deletions

View file

@ -13,31 +13,6 @@
.builds,
.projects-table {
.alert-success {
background-color: #6fc995;
border-color: #5bba83;
}
.alert-danger {
background-color: #eb897f;
border-color: #d4776e;
}
.alert-info {
background-color: #3498db;
border-color: #2e8ece;
}
.alert-warning {
background-color: #EB974E;
border-color: #E87E04;
}
.alert-disabled {
background: $background-color;
border-color: $border-color;
}
.light {
border-color: $border-color;
}
@ -47,8 +22,8 @@
}
td {
color: $gl-gray;
vertical-align: middle !important;
border-color: inherit !important;
a {
font-weight: normal;

View file

@ -16,15 +16,15 @@ module Ci
ci_project_build_url(build.project, build)
end
def build_status_alert_class(build)
def build_status_css_class(build)
if build.success?
'alert-success'
'build-success'
elsif build.failed?
'alert-danger'
'build-danger'
elsif build.canceled?
'alert-disabled'
'build-disabled'
else
'alert-warning'
'build-warning'
end
end

View file

@ -1,17 +1,17 @@
module Ci
module CommitsHelper
def commit_status_alert_class(commit)
return 'alert-info' unless commit
def commit_status_css_class(commit)
return 'build-info' unless commit
case commit.status
when 'success'
'alert-success'
'build-success'
when 'failed', 'canceled'
'alert-danger'
'build-danger'
when 'skipped'
'alert-disabled'
'build-disabled'
else
'alert-warning'
'build-warning'
end
end

View file

@ -1,5 +1,5 @@
- if build.commit && build.project
%tr.build.alert{class: build_status_alert_class(build)}
%tr.build{class: build_status_css_class(build)}
%td.build-link
= link_to ci_project_build_url(build.project, build) do
%strong #{build.id}

View file

@ -1,5 +1,5 @@
- last_commit = project.last_commit
%tr.alert{class: commit_status_alert_class(last_commit) }
%tr{class: commit_status_css_class(last_commit) }
%td
= project.id
%td

View file

@ -102,7 +102,7 @@
%th Finished at
- @builds.each do |build|
%tr.build.alert{class: build_status_alert_class(build)}
%tr.build.alert{class: build_status_css_class(build)}
%td.status
= build.status

View file

@ -1,4 +1,4 @@
%tr.build.alert{class: build_status_alert_class(build)}
%tr.build{class: build_status_css_class(build)}
%td.status
= build.status

View file

@ -21,7 +21,7 @@
.row
.col-md-9
.build-head.alert{class: build_status_alert_class(@build)}
.build-head.alert{class: build_status_css_class(@build)}
%h4
- if @build.commit.tag?
Build for tag
@ -150,7 +150,7 @@
%h4.title #{pluralize(@builds.count, "other build")} for #{@build.short_sha}:
%table.builds
- @builds.each_with_index do |build, i|
%tr.build.alert{class: build_status_alert_class(build)}
%tr.build.alert{class: build_status_css_class(build)}
%td
= link_to ci_project_build_url(@project, build) do
%span ##{build.id}

View file

@ -1,4 +1,4 @@
%tr.build.alert{class: commit_status_alert_class(commit)}
%tr.build{class: commit_status_css_class(commit)}
%td.status
= commit.status
- if commit.running?

View file

@ -44,7 +44,7 @@
%h3 Status
.build.alert{class: commit_status_alert_class(@commit)}
.build.alert{class: commit_status_css_class(@commit)}
.status
= @commit.status.titleize

View file

@ -1,5 +1,5 @@
- last_commit = project.last_commit
%tr.alert{class: commit_status_alert_class(last_commit) }
%tr{class: commit_status_css_class(last_commit) }
%td
= link_to [:ci, project] do
= project.name