Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d2256300
Commit
d2256300
authored
May 17, 2018
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hint the allowed image formats on favicon upload
parent
cb564d58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
app/helpers/favicon_helper.rb
app/helpers/favicon_helper.rb
+7
-0
app/uploaders/favicon_uploader.rb
app/uploaders/favicon_uploader.rb
+3
-1
app/views/admin/appearances/_form.html.haml
app/views/admin/appearances/_form.html.haml
+3
-1
No files found.
app/helpers/favicon_helper.rb
0 → 100644
View file @
d2256300
module
FaviconHelper
def
favicon_extension_whitelist
FaviconUploader
::
EXTENSION_WHITELIST
.
map
{
|
extension
|
"'.
#{
extension
}
'"
}
.
to_sentence
end
end
app/uploaders/favicon_uploader.rb
View file @
d2256300
class
FaviconUploader
<
AttachmentUploader
class
FaviconUploader
<
AttachmentUploader
EXTENSION_WHITELIST
=
%w[png ico]
.
freeze
include
CarrierWave
::
MiniMagick
include
CarrierWave
::
MiniMagick
version
:favicon_main
do
version
:favicon_main
do
...
@@ -11,7 +13,7 @@ class FaviconUploader < AttachmentUploader
...
@@ -11,7 +13,7 @@ class FaviconUploader < AttachmentUploader
end
end
def
extension_whitelist
def
extension_whitelist
%w[png ico]
EXTENSION_WHITELIST
end
end
private
private
...
...
app/views/admin/appearances/_form.html.haml
View file @
d2256300
...
@@ -70,7 +70,9 @@
...
@@ -70,7 +70,9 @@
=
f
.
hidden_field
:favicon_cache
=
f
.
hidden_field
:favicon_cache
=
f
.
file_field
:favicon
,
class:
''
=
f
.
file_field
:favicon
,
class:
''
.hint
.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
.form-actions
=
f
.
submit
'Save'
,
class:
'btn btn-save append-right-10'
=
f
.
submit
'Save'
,
class:
'btn btn-save append-right-10'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment