Split Logos and Icons into separate steps

This commit is contained in:
Robin Ward 2016-09-16 12:13:54 -04:00
parent 05d1c8167f
commit 28cd49f02b
3 changed files with 26 additions and 4 deletions

View File

@ -3306,6 +3306,10 @@ en:
logo_small_url:
label: "Small Logo"
description: "The small logo image at the top left of your site, should be a square shape, seen when scrolling down."
icons:
title: "Icons"
fields:
favicon_url:
label: "Small Icon"
description: "A <a href='http://en.wikipedia.org/wiki/Favicon' target='blank'>favicon</a> for your site. To work correctly over a CDN it must be a png."

View File

@ -133,11 +133,18 @@ class Wizard
@wizard.append_step('logos') do |step|
step.add_field(id: 'logo_url', type: 'image', value: SiteSetting.logo_url)
step.add_field(id: 'logo_small_url', type: 'image', value: SiteSetting.logo_small_url)
step.on_update do |updater|
updater.apply_settings(:logo_url, :logo_small_url)
end
end
@wizard.append_step('icons') do |step|
step.add_field(id: 'favicon_url', type: 'image', value: SiteSetting.favicon_url)
step.add_field(id: 'apple_touch_icon_url', type: 'image', value: SiteSetting.apple_touch_icon_url)
step.on_update do |updater|
updater.apply_settings(:logo_url, :logo_small_url, :favicon_url, :apple_touch_icon_url)
updater.apply_settings(:favicon_url, :apple_touch_icon_url)
end
end

View File

@ -165,20 +165,31 @@ describe Wizard::StepUpdater do
it "updates the fields correctly" do
updater = wizard.create_updater('logos',
logo_url: '/uploads/logo.png',
logo_small_url: '/uploads/logo-small.png',
favicon_url: "/uploads/favicon.png",
apple_touch_icon_url: "/uploads/apple.png")
logo_small_url: '/uploads/logo-small.png')
updater.update
expect(updater).to be_success
expect(wizard.completed_steps?('logos')).to eq(true)
expect(SiteSetting.logo_url).to eq('/uploads/logo.png')
expect(SiteSetting.logo_small_url).to eq('/uploads/logo-small.png')
end
end
context "icons step" do
it "updates the fields correctly" do
updater = wizard.create_updater('icons',
favicon_url: "/uploads/favicon.png",
apple_touch_icon_url: "/uploads/apple.png")
updater.update
expect(updater).to be_success
expect(wizard.completed_steps?('icons')).to eq(true)
expect(SiteSetting.favicon_url).to eq('/uploads/favicon.png')
expect(SiteSetting.apple_touch_icon_url).to eq('/uploads/apple.png')
end
end
context "invites step" do
let(:invites) {
return [{ email: 'regular@example.com', role: 'regular'},