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
Léo-Paul Géneau
gitlab-ce
Commits
44d7b158
Commit
44d7b158
authored
Sep 27, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use custom favicon for ci build status favicons
parent
a6f3f6b8
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
37 additions
and
21 deletions
+37
-21
app/serializers/status_entity.rb
app/serializers/status_entity.rb
+1
-10
lib/gitlab/ci/status/canceled.rb
lib/gitlab/ci/status/canceled.rb
+1
-1
lib/gitlab/ci/status/created.rb
lib/gitlab/ci/status/created.rb
+1
-1
lib/gitlab/ci/status/failed.rb
lib/gitlab/ci/status/failed.rb
+1
-1
lib/gitlab/ci/status/manual.rb
lib/gitlab/ci/status/manual.rb
+1
-1
lib/gitlab/ci/status/pending.rb
lib/gitlab/ci/status/pending.rb
+1
-1
lib/gitlab/ci/status/running.rb
lib/gitlab/ci/status/running.rb
+1
-1
lib/gitlab/ci/status/skipped.rb
lib/gitlab/ci/status/skipped.rb
+1
-1
lib/gitlab/ci/status/success.rb
lib/gitlab/ci/status/success.rb
+1
-1
lib/gitlab/favicon.rb
lib/gitlab/favicon.rb
+15
-3
spec/lib/gitlab/favicon_spec.rb
spec/lib/gitlab/favicon_spec.rb
+13
-0
No files found.
app/serializers/status_entity.rb
View file @
44d7b158
...
@@ -7,16 +7,7 @@ class StatusEntity < Grape::Entity
...
@@ -7,16 +7,7 @@ class StatusEntity < Grape::Entity
expose
:details_path
expose
:details_path
expose
:favicon
do
|
status
|
expose
:favicon
do
|
status
|
dir
=
ActionController
::
Base
.
helpers
.
image_path
(
status
.
favicon
)
if
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'CANARY'
])
File
.
join
(
'ci_favicons'
,
'canary'
)
elsif
Rails
.
env
.
development?
File
.
join
(
'ci_favicons'
,
'dev'
)
else
'ci_favicons'
end
ActionController
::
Base
.
helpers
.
image_path
(
File
.
join
(
dir
,
"
#{
status
.
favicon
}
.ico"
))
end
end
expose
:action
,
if:
->
(
status
,
_
)
{
status
.
has_action?
}
do
expose
:action
,
if:
->
(
status
,
_
)
{
status
.
has_action?
}
do
...
...
lib/gitlab/ci/status/canceled.rb
View file @
44d7b158
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
end
end
def
favicon
def
favicon
'favicon_status_canceled'
Gitlab
::
Favicon
.
status
(
'canceled'
)
end
end
end
end
end
end
...
...
lib/gitlab/ci/status/created.rb
View file @
44d7b158
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
end
end
def
favicon
def
favicon
'favicon_status_created'
Gitlab
::
Favicon
.
status
(
'created'
)
end
end
end
end
end
end
...
...
lib/gitlab/ci/status/failed.rb
View file @
44d7b158
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
end
end
def
favicon
def
favicon
'favicon_status_failed'
Gitlab
::
Favicon
.
status
(
'failed'
)
end
end
end
end
end
end
...
...
lib/gitlab/ci/status/manual.rb
View file @
44d7b158
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
end
end
def
favicon
def
favicon
'favicon_status_manual'
Gitlab
::
Favicon
.
status
(
'manual'
)
end
end
end
end
end
end
...
...
lib/gitlab/ci/status/pending.rb
View file @
44d7b158
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
end
end
def
favicon
def
favicon
'favicon_status_pending'
Gitlab
::
Favicon
.
status
(
'pending'
)
end
end
end
end
end
end
...
...
lib/gitlab/ci/status/running.rb
View file @
44d7b158
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
end
end
def
favicon
def
favicon
'favicon_status_running'
Gitlab
::
Favicon
.
status
(
'running'
)
end
end
end
end
end
end
...
...
lib/gitlab/ci/status/skipped.rb
View file @
44d7b158
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
end
end
def
favicon
def
favicon
'favicon_status_skipped'
Gitlab
::
Favicon
.
status
(
'skipped'
)
end
end
end
end
end
end
...
...
lib/gitlab/ci/status/success.rb
View file @
44d7b158
...
@@ -15,7 +15,7 @@ module Gitlab
...
@@ -15,7 +15,7 @@ module Gitlab
end
end
def
favicon
def
favicon
'favicon_status_success'
Gitlab
::
Favicon
.
status
(
'success'
)
end
end
end
end
end
end
...
...
lib/gitlab/favicon.rb
View file @
44d7b158
...
@@ -2,21 +2,33 @@ module Gitlab
...
@@ -2,21 +2,33 @@ module Gitlab
class
Favicon
class
Favicon
class
<<
self
class
<<
self
def
default
def
default
return
appearance_favicon
.
default
.
url
if
appearance_favicon
return
appearance_favicon
.
default
.
url
if
appearance_favicon
.
exists?
return
'favicon-yellow.ico'
if
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'CANARY'
])
return
'favicon-yellow.ico'
if
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'CANARY'
])
return
'favicon-blue.ico'
if
Rails
.
env
.
development?
return
'favicon-blue.ico'
if
Rails
.
env
.
development?
'favicon.ico'
'favicon.ico'
end
end
def
status
(
status_name
)
if
appearance_favicon
.
exists?
appearance_favicon
.
public_send
(
"status_
#{
status_name
}
"
).
url
else
dir
=
'ci_favicons'
dir
=
File
.
join
(
dir
,
'dev'
)
if
Rails
.
env
.
development?
dir
=
File
.
join
(
dir
,
'canary'
)
if
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'CANARY'
])
File
.
join
(
dir
,
"favicon_status_
#{
status_name
}
.ico"
)
end
end
private
private
def
appearance
def
appearance
@appearance
||=
Appearance
.
current
Appearance
.
current
||
Appearance
.
new
end
end
def
appearance_favicon
def
appearance_favicon
appearance
&
.
favicon
appearance
.
favicon
end
end
end
end
end
end
...
...
spec/lib/gitlab/favicon_spec.rb
View file @
44d7b158
...
@@ -22,4 +22,17 @@ RSpec.describe Gitlab::Favicon do
...
@@ -22,4 +22,17 @@ RSpec.describe Gitlab::Favicon do
expect
(
described_class
.
default
).
to
match
%r{/uploads/-/system/appearance/favicon/
\d
+/default_dk.ico}
expect
(
described_class
.
default
).
to
match
%r{/uploads/-/system/appearance/favicon/
\d
+/default_dk.ico}
end
end
end
end
describe
'.status'
do
subject
{
described_class
.
status
(
'created'
)
}
it
'defaults to the stock icon'
do
expect
(
subject
).
to
eq
'ci_favicons/favicon_status_created.ico'
end
it
'uses the custom favicon if a favicon appearance is present'
do
create
:appearance
,
favicon:
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
expect
(
subject
).
to
match
(
%r{/uploads/-/system/appearance/favicon/
\d
+/status_created_dk.ico}
)
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