Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
3084c8c3
Commit
3084c8c3
authored
Dec 12, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define CI status icon colors in SCSS instead of a helper
parent
a5e44957
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
26 deletions
+24
-26
app/assets/stylesheets/pages/status.scss
app/assets/stylesheets/pages/status.scss
+17
-0
app/helpers/ci_status_helper.rb
app/helpers/ci_status_helper.rb
+4
-18
spec/helpers/ci_status_helper_spec.rb
spec/helpers/ci_status_helper_spec.rb
+3
-8
No files found.
app/assets/stylesheets/pages/status.scss
View file @
3084c8c3
...
@@ -35,3 +35,20 @@
...
@@ -35,3 +35,20 @@
border-color
:
$gl-warning
;
border-color
:
$gl-warning
;
}
}
}
}
.ci-status-icon-success
{
@extend
.cgreen
;
}
.ci-status-icon-failed
{
@extend
.cred
;
}
.ci-status-icon-running
,
.ci-status-icon-pending
{
// These are standard text color
}
.ci-status-icon-canceled
,
.ci-status-icon-disabled
,
.ci-status-icon-not-found
,
.ci-status-icon-skipped
{
@extend
.cgray
;
}
app/helpers/ci_status_helper.rb
View file @
3084c8c3
...
@@ -12,19 +12,6 @@ module CiStatusHelper
...
@@ -12,19 +12,6 @@ module CiStatusHelper
ci_label_for_status
(
ci_commit
.
status
)
ci_label_for_status
(
ci_commit
.
status
)
end
end
def
ci_status_color
(
ci_commit
)
case
ci_commit
.
status
when
'success'
'green'
when
'failed'
'red'
when
'running'
,
'pending'
'yellow'
else
'gray'
end
end
def
ci_status_with_icon
(
status
)
def
ci_status_with_icon
(
status
)
content_tag
:span
,
class:
"ci-status ci-
#{
status
}
"
do
content_tag
:span
,
class:
"ci-status ci-
#{
status
}
"
do
ci_icon_for_status
(
status
)
+
' '
.
html_safe
+
ci_label_for_status
(
status
)
ci_icon_for_status
(
status
)
+
' '
.
html_safe
+
ci_label_for_status
(
status
)
...
@@ -56,11 +43,10 @@ module CiStatusHelper
...
@@ -56,11 +43,10 @@ module CiStatusHelper
end
end
def
render_ci_status
(
ci_commit
)
def
render_ci_status
(
ci_commit
)
link_to
ci_status_path
(
ci_commit
),
link_to
ci_status_icon
(
ci_commit
),
class:
"c
#{
ci_status_color
(
ci_commit
)
}
"
,
ci_status_path
(
ci_commit
),
class:
"ci-status-icon-
#{
ci_commit
.
status
.
dasherize
}
"
,
title:
"Build
#{
ci_status_label
(
ci_commit
)
}
"
,
title:
"Build
#{
ci_status_label
(
ci_commit
)
}
"
,
data:
{
toggle:
'tooltip'
,
placement:
'left'
}
do
data:
{
toggle:
'tooltip'
,
placement:
'left'
}
ci_status_icon
(
ci_commit
)
end
end
end
end
end
spec/helpers/ci_status_helper_spec.rb
View file @
3084c8c3
...
@@ -6,13 +6,8 @@ describe CiStatusHelper do
...
@@ -6,13 +6,8 @@ describe CiStatusHelper do
let
(
:success_commit
)
{
double
(
"Ci::Commit"
,
status:
'success'
)
}
let
(
:success_commit
)
{
double
(
"Ci::Commit"
,
status:
'success'
)
}
let
(
:failed_commit
)
{
double
(
"Ci::Commit"
,
status:
'failed'
)
}
let
(
:failed_commit
)
{
double
(
"Ci::Commit"
,
status:
'failed'
)
}
describe
'ci_status_color'
do
describe
'ci_status_icon'
do
it
{
expect
(
ci_status_icon
(
success_commit
)).
to
include
(
'fa-check'
)
}
it
{
expect
(
helper
.
ci_status_icon
(
success_commit
)).
to
include
(
'fa-check'
)
}
it
{
expect
(
ci_status_icon
(
failed_commit
)).
to
include
(
'fa-close'
)
}
it
{
expect
(
helper
.
ci_status_icon
(
failed_commit
)).
to
include
(
'fa-close'
)
}
end
describe
'ci_status_color'
do
it
{
expect
(
ci_status_color
(
success_commit
)).
to
eq
(
'green'
)
}
it
{
expect
(
ci_status_color
(
failed_commit
)).
to
eq
(
'red'
)
}
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment