Commit 9156882f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve GitLab EE appearance

* Fix bug with redirect to image logo after login
* Use one (light) logo for header
* Improve header logo preview
* Dont require authentication for appearance images
parent d0d82c0c
......@@ -3,10 +3,9 @@
margin-bottom: 20px;
}
.appearance-dark-logo-preview {
background-color: #F1F1F1;
}
.appearance-light-logo-preview {
background-color: #373737;
background-color: $style_color;
max-width: 72px;
padding: 10px;
margin-bottom: 10px;
}
......@@ -37,11 +37,9 @@ class Admin::AppearancesController < Admin::ApplicationController
def header_logos
appearance = Appearance.last
appearance.remove_light_logo!
appearance.remove_dark_logo!
appearance.save
redirect_to admin_appearances_path, notice: 'Header logos were succesfully removed.'
redirect_to admin_appearances_path, notice: 'Header logo were succesfully removed.'
end
private
......
......@@ -29,7 +29,7 @@ class UploadsController < ApplicationController
private
def authorize_access
unless params[:mounted_as] == 'avatar'
unless params[:mounted_as] == 'avatar' || params[:mounted_as] == 'light_logo' || params[:mounted_as] == 'logo'
authenticate_user! && reject_blocked!
end
end
......
......@@ -15,21 +15,6 @@ module AppearancesHelper
end
end
def brand_header_logo
if brand_item.header_logos?
haml_tag(:style) do
# Dark theme/light logo
haml_concat ".dark_theme .app_logo a h1 {" \
"background: url('#{brand_item.light_logo}') " \
"no-repeat center center !important; }"
# Light theme/dark logo
haml_concat ".light_theme .app_logo a h1 {" \
"background: url('#{brand_item.dark_logo}') " \
"no-repeat center center !important; }"
end
end
end
def brand_text
markdown(brand_item.description)
end
......@@ -39,6 +24,10 @@ module AppearancesHelper
end
def brand_header_logo
image_tag 'logo-white.png'
if brand_item.light_logo?
image_tag brand_item.light_logo
else
image_tag 'logo-white.png'
end
end
end
......@@ -2,19 +2,8 @@ class Appearance < ActiveRecord::Base
validates :title, presence: true
validates :description, presence: true
validates :logo, file_size: { maximum: 1000.kilobytes.to_i }
validates :dark_logo,
file_size: { maximum: 1000.kilobytes.to_i },
presence: true, if: :light_logo?
validates :light_logo,
file_size: { maximum: 1000.kilobytes.to_i },
presence: true, if: :dark_logo?
validates :light_logo, file_size: { maximum: 1000.kilobytes.to_i }
mount_uploader :logo, AttachmentUploader
mount_uploader :dark_logo, AttachmentUploader
mount_uploader :light_logo, AttachmentUploader
def header_logos?
dark_logo? && light_logo?
end
end
......@@ -33,23 +33,16 @@
%legend
Navigation bar:
.form-group
= f.label :dark_logo, class: 'control-label'
.col-sm-10
- if @appearance.dark_logo?
= image_tag @appearance.dark_logo, class: 'appearance-dark-logo-preview'
= f.file_field :dark_logo, class: ""
.hint
Maximum size is 1MB, page optimized for logo size 40x40px
= f.label :light_logo, class: 'control-label'
= f.label :light_logo, 'Header logo', class: 'control-label'
.col-sm-10
- if @appearance.light_logo?
= image_tag @appearance.light_logo, class: 'appearance-light-logo-preview'
= f.file_field :light_logo, class: ""
.hint
Maximum size is 1MB, page optimized for logo size 41x41px
-if @appearance.light_logo? || @appearance.dark_logo?
Maximum size is 1MB, page optimized for logo size 72x72px
-if @appearance.light_logo?
%br
= link_to 'Remove header logos', header_logos_admin_appearances_path, data: { confirm: "Header logos will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-logo"
= link_to 'Remove header logo', header_logos_admin_appearances_path, data: { confirm: "Header logos will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-logo"
.form-actions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment