diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-09-28 14:57:08 +0300 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2018-06-05 17:20:21 +0300 |
commit | 67fe0a17d87a7a5380b41e04ef23212d5da637ba (patch) | |
tree | 2be846ca693640f73058ebd0dd1b39b06e3f2666 /app | |
parent | 40ffa8401b96dda5f67ea699dbcca0ff64263810 (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 'app')
-rw-r--r-- | app/helpers/page_layout_helper.rb | 2 | ||||
-rw-r--r-- | app/serializers/status_entity.rb | 2 | ||||
-rw-r--r-- | app/uploaders/favicon_uploader.rb | 26 | ||||
-rw-r--r-- | app/views/admin/appearances/_form.html.haml | 2 |
4 files changed, 16 insertions, 16 deletions
diff --git a/app/helpers/page_layout_helper.rb b/app/helpers/page_layout_helper.rb index c3dd204181d..68d892393ef 100644 --- a/app/helpers/page_layout_helper.rb +++ b/app/helpers/page_layout_helper.rb @@ -39,7 +39,7 @@ module PageLayoutHelper end def favicon - Gitlab::Favicon.default + Gitlab::Favicon.main end def page_image diff --git a/app/serializers/status_entity.rb b/app/serializers/status_entity.rb index f4d0a33d466..2f3d4b80565 100644 --- a/app/serializers/status_entity.rb +++ b/app/serializers/status_entity.rb @@ -7,7 +7,7 @@ class StatusEntity < Grape::Entity expose :details_path expose :favicon do |status| - ActionController::Base.helpers.image_path(status.favicon) + Gitlab::Favicon.status(status.favicon) end expose :action, if: -> (status, _) { status.has_action? } do diff --git a/app/uploaders/favicon_uploader.rb b/app/uploaders/favicon_uploader.rb index d3debc16fa9..7697f5fe885 100644 --- a/app/uploaders/favicon_uploader.rb +++ b/app/uploaders/favicon_uploader.rb @@ -2,19 +2,19 @@ class FaviconUploader < AttachmentUploader include CarrierWave::MiniMagick STATUS_ICON_NAMES = [ - :status_canceled, - :status_created, - :status_failed, - :status_manual, - :status_not_found, - :status_pending, - :status_running, - :status_skipped, - :status_success, - :status_warning + :favicon_status_canceled, + :favicon_status_created, + :favicon_status_failed, + :favicon_status_manual, + :favicon_status_not_found, + :favicon_status_pending, + :favicon_status_running, + :favicon_status_skipped, + :favicon_status_success, + :favicon_status_warning ].freeze - version :default do + version :favicon_main do process resize_to_fill: [32, 32] process convert: 'ico' @@ -24,7 +24,7 @@ class FaviconUploader < AttachmentUploader end STATUS_ICON_NAMES.each do |status_name| - version status_name, from_version: :default do + version status_name, from_version: :favicon_main do process status_favicon: status_name def full_filename(filename) @@ -41,7 +41,7 @@ class FaviconUploader < AttachmentUploader def status_favicon(status_name) manipulate! do |img| - overlay_path = Rails.root.join("app/assets/images/ci_favicons/overlays/favicon_#{status_name}.png") + overlay_path = Rails.root.join("app/assets/images/ci_favicons/overlays/#{status_name}.png") overlay = MiniMagick::Image.open(overlay_path) img.composite(overlay) do |c| c.compose 'over' diff --git a/app/views/admin/appearances/_form.html.haml b/app/views/admin/appearances/_form.html.haml index 8d73bd8fb55..1119c75637c 100644 --- a/app/views/admin/appearances/_form.html.haml +++ b/app/views/admin/appearances/_form.html.haml @@ -62,7 +62,7 @@ = f.label :favicon, 'Favicon', class: 'control-label' .col-sm-10 - if @appearance.favicon? - = image_tag @appearance.favicon.default.url, class: 'appearance-light-logo-preview' + = image_tag @appearance.favicon.favicon_main.url, class: 'appearance-light-logo-preview' - if @appearance.favicon? = f.label :favicon, 'Generated status icons', class: 'control-label' .col-sm-10 |