Commit 7202371c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'fix-brand-header-logo' into 'master'

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
* remove duplicated oauth providers on login page

See merge request !339
parents d0d82c0c eaf25df3
......@@ -2,6 +2,7 @@ v 7.9.0 (unreleased)
- Strip prefixes and suffixes from synced SSH keys:
`SSHKey:ssh-rsa keykeykey` and `ssh-rsa keykeykey (SSH key)` will now work
- Check if LDAP admin group exists before querying for user membership
- Use one custom header logo for all GitLab themes in appearance settings
v 7.8.0
- Improved Jira issue closing integration
......
......@@ -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 %w(avatar logo light_logo).include?(params[:mounted_as])
authenticate_user! && reject_blocked!
end
end
......@@ -39,14 +39,15 @@ class UploadsController < ApplicationController
user: User,
project: Project,
note: Note,
group: Group
group: Group,
appearance: Appearance
}
upload_models[params[:model].to_sym]
end
def upload_mount
upload_mounts = %w(avatar attachment file)
upload_mounts = %w(avatar attachment file logo light_logo)
if upload_mounts.include?(params[:mounted_as])
params[:mounted_as]
......
......@@ -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
if brand_item && 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
......
......@@ -30,19 +30,3 @@
- elsif signin_enabled?
= render 'devise/sessions/new_base'
- else
%div
No authentication methods configured.
- if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?
.clearfix.prepend-top-20
%p
%span.light
Sign in with &nbsp;
- providers = additional_providers
- providers.each do |provider|
%span.light
- if default_providers.include?(provider)
= link_to authbutton(provider, 32), omniauth_authorize_path(resource_name, provider)
- else
= link_to provider.to_s.titleize, omniauth_authorize_path(resource_name, provider), class: "btn"
......@@ -2,7 +2,6 @@
.navbar-inner
.container
%div.app_logo
- brand_header_logo if brand_item
= link_to root_path, class: "home has_bottom_tooltip", title: "Dashboard" do
= brand_header_logo
%h1.title= title
......
......@@ -39,7 +39,6 @@ class Spinach::Features::AdminAppearance < Spinach::FeatureSteps
step 'I attach header logos' do
attach_file(:appearance_light_logo, File.join(Rails.root, 'public', 'header_logo_light.png'))
attach_file(:appearance_dark_logo, File.join(Rails.root, 'public', 'header_logo_dark.png'))
click_button 'Save'
end
......@@ -49,7 +48,6 @@ class Spinach::Features::AdminAppearance < Spinach::FeatureSteps
step 'I should see header logos' do
page.should have_xpath('//img[@src="/uploads/appearance/light_logo/1/header_logo_light.png"]')
page.should have_xpath('//img[@src="/uploads/appearance/dark_logo/1/header_logo_dark.png"]')
end
step 'I remove the logo' do
......@@ -57,7 +55,7 @@ class Spinach::Features::AdminAppearance < Spinach::FeatureSteps
end
step 'I remove the header logos' do
click_link 'Remove header logos'
click_link 'Remove header logo'
end
step 'I should see logo removed' do
......@@ -66,7 +64,6 @@ class Spinach::Features::AdminAppearance < Spinach::FeatureSteps
step 'I should see header logos removed' do
page.should_not have_xpath('//img[@src="/uploads/appearance/light_logo/1/header_logo_light.png"]')
page.should_not have_xpath('//img[@src="/uploads/appearance/dark_logo/1/header_logo_dark.png"]')
end
def appearance
......
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