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 <alexis.reigel.ext@siemens.com>2017-12-06 23:04:53 +0300
committerAlexis Reigel <mail@koffeinfrei.org>2018-06-05 17:20:21 +0300
commit9e14f437b6ed205744d916f5566ee2c11e52b734 (patch)
tree5c4bf1237cfc4a6cf73f30f942d25e0ab4f0973c /app/uploaders
parent5202c3f0c8da618e2d3821917f6f5d48ae8ae3c2 (diff)
create favicon overlay on the client
the initial reason for this change was that graphicsmagick does not support writing to ico files. this fact lead to a chain of changes: 1. use png instead of ico (browser support is good enough) 2. render the overlays on the client using the canvas API. this way we only need to store the original favion and generate the overlay versions dynamically. this change also enables (next step) to simplify the handling of the stock favicons as well, as we don't need to generate all the versions upfront.
Diffstat (limited to 'app/uploaders')
-rw-r--r--app/uploaders/favicon_uploader.rb37
1 files changed, 2 insertions, 35 deletions
diff --git a/app/uploaders/favicon_uploader.rb b/app/uploaders/favicon_uploader.rb
index 7697f5fe885..d7be77477b2 100644
--- a/app/uploaders/favicon_uploader.rb
+++ b/app/uploaders/favicon_uploader.rb
@@ -1,35 +1,12 @@
class FaviconUploader < AttachmentUploader
include CarrierWave::MiniMagick
- STATUS_ICON_NAMES = [
- :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 :favicon_main do
process resize_to_fill: [32, 32]
- process convert: 'ico'
+ process convert: 'png'
def full_filename(filename)
- filename_for_different_format(super(filename), 'ico')
- end
- end
-
- STATUS_ICON_NAMES.each do |status_name|
- version status_name, from_version: :favicon_main do
- process status_favicon: status_name
-
- def full_filename(filename)
- filename_for_different_format(super(filename), 'ico')
- end
+ filename_for_different_format(super(filename), 'png')
end
end
@@ -39,16 +16,6 @@ class FaviconUploader < AttachmentUploader
private
- def status_favicon(status_name)
- manipulate! do |img|
- 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'
- end
- end
- end
-
def filename_for_different_format(filename, format)
filename.chomp(File.extname(filename)) + ".#{format}"
end