Skip to content
Snippets Groups Projects
Unverified Commit d2256300 authored by Alexis Reigel's avatar Alexis Reigel
Browse files

hint the allowed image formats on favicon upload

parent cb564d58
No related branches found
No related tags found
No related merge requests found
module FaviconHelper
def favicon_extension_whitelist
FaviconUploader::EXTENSION_WHITELIST
.map { |extension| "'.#{extension}'"}
.to_sentence
end
end
class FaviconUploader < AttachmentUploader
EXTENSION_WHITELIST = %w[png ico].freeze
include CarrierWave::MiniMagick
 
version :favicon_main do
Loading
Loading
@@ -11,7 +13,7 @@ class FaviconUploader < AttachmentUploader
end
 
def extension_whitelist
%w[png ico]
EXTENSION_WHITELIST
end
 
private
Loading
Loading
Loading
Loading
@@ -70,7 +70,9 @@
= f.hidden_field :favicon_cache
= f.file_field :favicon, class: ''
.hint
Maximum file size is 1MB. The resulting favicons will be cropped to be square and scaled down to a size of 32x32 px.
Maximum file size is 1MB. Allowed image formats are #{favicon_extension_whitelist}.
%br
The resulting favicons will be cropped to be square and scaled down to a size of 32x32 px.
 
.form-actions
= f.submit 'Save', class: 'btn btn-save append-right-10'
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment