diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-09-28 13:57:08 +0200 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2018-06-05 16:20:21 +0200 |
commit | 67fe0a17d87a7a5380b41e04ef23212d5da637ba (patch) | |
tree | 2be846ca693640f73058ebd0dd1b39b06e3f2666 /lib/gitlab/favicon.rb | |
parent | 40ffa8401b96dda5f67ea699dbcca0ff64263810 (diff) | |
download | gitlab-ce-67fe0a17d87a7a5380b41e04ef23212d5da637ba.tar.gz |
call Gitlab::Favicon.status in serializer
this ways we can keep the `lib/gitlab/ci/status/*` classes to return the
bare favicon name as it was before.
also the favicon uploader versions are now have the same names as the
stock favicons (+ `favicon_` prefix), which makes working with the
status names easier.
Diffstat (limited to 'lib/gitlab/favicon.rb')
-rw-r--r-- | lib/gitlab/favicon.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/gitlab/favicon.rb b/lib/gitlab/favicon.rb index 8802f58e31c..51a25b408ee 100644 --- a/lib/gitlab/favicon.rb +++ b/lib/gitlab/favicon.rb @@ -1,8 +1,8 @@ module Gitlab class Favicon class << self - def default - return custom_favicon_url(appearance_favicon.default.url) if appearance_favicon.exists? + def main + return custom_favicon_url(appearance_favicon.favicon_main.url) if appearance_favicon.exists? return 'favicon-yellow.ico' if Gitlab::Utils.to_boolean(ENV['CANARY']) return 'favicon-blue.ico' if Rails.env.development? @@ -11,13 +11,16 @@ module Gitlab def status(status_name) if appearance_favicon.exists? - custom_favicon_url(appearance_favicon.public_send("status_#{status_name}").url) # rubocop:disable GitlabSecurity/PublicSend + custom_favicon_url(appearance_favicon.public_send("#{status_name}").url) # rubocop:disable GitlabSecurity/PublicSend 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']) + path = File.join( + 'ci_favicons', + Rails.env.development? ? 'dev' : '', + Gitlab::Utils.to_boolean(ENV['CANARY']) ? 'canary' : '', + "#{status_name}.ico" + ) - File.join(dir, "favicon_status_#{status_name}.ico") + ActionController::Base.helpers.image_path(path) end end |