Commit 38382514 authored by Marin Jankovski's avatar Marin Jankovski

Add ability to remove the branded page logo.

parent c7f610d7
......@@ -25,6 +25,15 @@ class Admin::AppearancesController < Admin::ApplicationController
end
end
def logo
appearance = Appearance.last
appearance.remove_logo!
appearance.save
redirect_to admin_appearances_path, notice: 'Logo was succesfully removed.'
end
private
# Use callbacks to share common setup or constraints between actions.
......
......@@ -19,6 +19,9 @@
.col-sm-10
- if @appearance.logo?
= image_tag @appearance.logo, class: 'appearance-logo-preview'
%br
= link_to 'Remove logo', logo_admin_appearances_path, data: { confirm: "Logo will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-logo"
%hr
= f.file_field :logo, class: ""
.hint
Maximum logo size is 1MB, page optimized for logo size 640x360px
......
......@@ -108,6 +108,7 @@ Gitlab::Application.routes.draw do
resource :appearances, path: 'appearance' do
member do
get :preview
delete :logo
end
end
......
......@@ -17,3 +17,12 @@ Feature: Admin Appearance
Given application has custom appearance
When I visit login page
Then I should see a customized appearance
Scenario: Appearance logo
Given application has custom appearance
And I sign in as an admin
And I visit admin appearance page
When I attach a logo
Then I should see a logo
And I remove the logo
Then I should see logo removed
......@@ -32,6 +32,23 @@ class Spinach::Features::AdminAppearance < Spinach::FeatureSteps
page.should have_content appearance.description
end
step 'I attach a logo' do
attach_file(:appearance_logo, File.join(Rails.root, 'public', 'gitlab_logo.png'))
click_button 'Save'
end
step 'I should see a logo' do
page.should have_xpath('//img[@src="/uploads/appearance/logo/1/gitlab_logo.png"]')
end
step 'I remove the logo' do
click_link 'Remove logo'
end
step 'I should see logo removed' do
page.should_not have_xpath('//img[@src="/uploads/appearance/logo/1/gitlab_logo.png"]')
end
def appearance
Appearance.last
end
......
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