summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-09-26 09:51:24 +0200
committerAlexis Reigel <mail@koffeinfrei.org>2018-06-05 16:20:06 +0200
commitc8a4d202c99c772822a2b9b09fa6da2c90b2ae81 (patch)
tree0680404038d5923bd659e8557dd578341d4688d2 /app
parent9921830267ccef2321e9a57383b28daafd34fa78 (diff)
downloadgitlab-ce-c8a4d202c99c772822a2b9b09fa6da2c90b2ae81.tar.gz
favicon uploader generating ci status favicons
Diffstat (limited to 'app')
-rw-r--r--app/assets/images/ci_favicons/overlays/favicon_status_canceled.pngbin0 -> 864 bytes
-rw-r--r--app/assets/images/ci_favicons/overlays/favicon_status_created.pngbin0 -> 889 bytes
-rw-r--r--app/assets/images/ci_favicons/overlays/favicon_status_failed.pngbin0 -> 1015 bytes
-rw-r--r--app/assets/images/ci_favicons/overlays/favicon_status_manual.pngbin0 -> 1067 bytes
-rw-r--r--app/assets/images/ci_favicons/overlays/favicon_status_not_found.pngbin0 -> 945 bytes
-rw-r--r--app/assets/images/ci_favicons/overlays/favicon_status_pending.pngbin0 -> 919 bytes
-rw-r--r--app/assets/images/ci_favicons/overlays/favicon_status_running.pngbin0 -> 1077 bytes
-rw-r--r--app/assets/images/ci_favicons/overlays/favicon_status_skipped.pngbin0 -> 923 bytes
-rw-r--r--app/assets/images/ci_favicons/overlays/favicon_status_success.pngbin0 -> 1044 bytes
-rw-r--r--app/assets/images/ci_favicons/overlays/favicon_status_warning.pngbin0 -> 830 bytes
-rw-r--r--app/uploaders/favicon_uploader.rb44
11 files changed, 44 insertions, 0 deletions
diff --git a/app/assets/images/ci_favicons/overlays/favicon_status_canceled.png b/app/assets/images/ci_favicons/overlays/favicon_status_canceled.png
new file mode 100644
index 00000000000..8adaa9c600b
--- /dev/null
+++ b/app/assets/images/ci_favicons/overlays/favicon_status_canceled.png
Binary files differ
diff --git a/app/assets/images/ci_favicons/overlays/favicon_status_created.png b/app/assets/images/ci_favicons/overlays/favicon_status_created.png
new file mode 100644
index 00000000000..ca788dd0034
--- /dev/null
+++ b/app/assets/images/ci_favicons/overlays/favicon_status_created.png
Binary files differ
diff --git a/app/assets/images/ci_favicons/overlays/favicon_status_failed.png b/app/assets/images/ci_favicons/overlays/favicon_status_failed.png
new file mode 100644
index 00000000000..93f1e2772fd
--- /dev/null
+++ b/app/assets/images/ci_favicons/overlays/favicon_status_failed.png
Binary files differ
diff --git a/app/assets/images/ci_favicons/overlays/favicon_status_manual.png b/app/assets/images/ci_favicons/overlays/favicon_status_manual.png
new file mode 100644
index 00000000000..c926062c806
--- /dev/null
+++ b/app/assets/images/ci_favicons/overlays/favicon_status_manual.png
Binary files differ
diff --git a/app/assets/images/ci_favicons/overlays/favicon_status_not_found.png b/app/assets/images/ci_favicons/overlays/favicon_status_not_found.png
new file mode 100644
index 00000000000..df3049315a9
--- /dev/null
+++ b/app/assets/images/ci_favicons/overlays/favicon_status_not_found.png
Binary files differ
diff --git a/app/assets/images/ci_favicons/overlays/favicon_status_pending.png b/app/assets/images/ci_favicons/overlays/favicon_status_pending.png
new file mode 100644
index 00000000000..f7d67d4a230
--- /dev/null
+++ b/app/assets/images/ci_favicons/overlays/favicon_status_pending.png
Binary files differ
diff --git a/app/assets/images/ci_favicons/overlays/favicon_status_running.png b/app/assets/images/ci_favicons/overlays/favicon_status_running.png
new file mode 100644
index 00000000000..ff4167c4b20
--- /dev/null
+++ b/app/assets/images/ci_favicons/overlays/favicon_status_running.png
Binary files differ
diff --git a/app/assets/images/ci_favicons/overlays/favicon_status_skipped.png b/app/assets/images/ci_favicons/overlays/favicon_status_skipped.png
new file mode 100644
index 00000000000..a9c36464b69
--- /dev/null
+++ b/app/assets/images/ci_favicons/overlays/favicon_status_skipped.png
Binary files differ
diff --git a/app/assets/images/ci_favicons/overlays/favicon_status_success.png b/app/assets/images/ci_favicons/overlays/favicon_status_success.png
new file mode 100644
index 00000000000..bcc30c73f5f
--- /dev/null
+++ b/app/assets/images/ci_favicons/overlays/favicon_status_success.png
Binary files differ
diff --git a/app/assets/images/ci_favicons/overlays/favicon_status_warning.png b/app/assets/images/ci_favicons/overlays/favicon_status_warning.png
new file mode 100644
index 00000000000..6db3b0280f5
--- /dev/null
+++ b/app/assets/images/ci_favicons/overlays/favicon_status_warning.png
Binary files differ
diff --git a/app/uploaders/favicon_uploader.rb b/app/uploaders/favicon_uploader.rb
new file mode 100644
index 00000000000..dc30e838337
--- /dev/null
+++ b/app/uploaders/favicon_uploader.rb
@@ -0,0 +1,44 @@
+class FaviconUploader < AttachmentUploader
+ include CarrierWave::MiniMagick
+
+ STATUS_ICON_NAMES = [
+ :status_not_found,
+ :status_canceled,
+ :status_success,
+ :status_skipped,
+ :status_created,
+ :status_failed,
+ :status_warning,
+ :status_pending,
+ :status_manual,
+ :status_running
+ ].freeze
+
+ version :default_without_format_conversion do
+ process resize_to_fill: [32, 32]
+ end
+
+ # this intermediate version generates an image in the ico format but with the
+ # original file suffix.
+ version :_default, from_version: :default_without_format_conversion do
+ process convert: 'ico'
+ end
+
+ version :default, from_version: :_default
+
+ STATUS_ICON_NAMES.each do |status_name|
+ version status_name, from_version: :default do
+ process status_favicon: status_name
+ end
+ end
+
+ def status_favicon(status_name)
+ manipulate! do |img|
+ overlay_path = Rails.root.join("app/assets/images/ci_favicons/overlays/favicon_#{status_name}.png")
+ overlay = MiniMagick::Image.open(overlay_path)
+ img.composite(overlay) do |c|
+ c.compose 'over'
+ end
+ end
+ end
+end