Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-09-28 14:57:08 +0300
committerAlexis Reigel <mail@koffeinfrei.org>2018-06-05 17:20:21 +0300
commit67fe0a17d87a7a5380b41e04ef23212d5da637ba (patch)
tree2be846ca693640f73058ebd0dd1b39b06e3f2666 /lib/gitlab/favicon.rb
parent40ffa8401b96dda5f67ea699dbcca0ff64263810 (diff)
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.rb17
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