mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Split Logos and Icons into separate steps
This commit is contained in:
parent
05d1c8167f
commit
28cd49f02b
3 changed files with 26 additions and 4 deletions
|
@ -3306,6 +3306,10 @@ en:
|
||||||
logo_small_url:
|
logo_small_url:
|
||||||
label: "Small Logo"
|
label: "Small Logo"
|
||||||
description: "The small logo image at the top left of your site, should be a square shape, seen when scrolling down."
|
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:
|
favicon_url:
|
||||||
label: "Small Icon"
|
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."
|
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."
|
||||||
|
|
|
@ -133,11 +133,18 @@ class Wizard
|
||||||
@wizard.append_step('logos') do |step|
|
@wizard.append_step('logos') do |step|
|
||||||
step.add_field(id: 'logo_url', type: 'image', value: SiteSetting.logo_url)
|
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.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: '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.add_field(id: 'apple_touch_icon_url', type: 'image', value: SiteSetting.apple_touch_icon_url)
|
||||||
|
|
||||||
step.on_update do |updater|
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -165,20 +165,31 @@ describe Wizard::StepUpdater do
|
||||||
it "updates the fields correctly" do
|
it "updates the fields correctly" do
|
||||||
updater = wizard.create_updater('logos',
|
updater = wizard.create_updater('logos',
|
||||||
logo_url: '/uploads/logo.png',
|
logo_url: '/uploads/logo.png',
|
||||||
logo_small_url: '/uploads/logo-small.png',
|
logo_small_url: '/uploads/logo-small.png')
|
||||||
favicon_url: "/uploads/favicon.png",
|
|
||||||
apple_touch_icon_url: "/uploads/apple.png")
|
|
||||||
updater.update
|
updater.update
|
||||||
|
|
||||||
expect(updater).to be_success
|
expect(updater).to be_success
|
||||||
expect(wizard.completed_steps?('logos')).to eq(true)
|
expect(wizard.completed_steps?('logos')).to eq(true)
|
||||||
expect(SiteSetting.logo_url).to eq('/uploads/logo.png')
|
expect(SiteSetting.logo_url).to eq('/uploads/logo.png')
|
||||||
expect(SiteSetting.logo_small_url).to eq('/uploads/logo-small.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.favicon_url).to eq('/uploads/favicon.png')
|
||||||
expect(SiteSetting.apple_touch_icon_url).to eq('/uploads/apple.png')
|
expect(SiteSetting.apple_touch_icon_url).to eq('/uploads/apple.png')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
context "invites step" do
|
context "invites step" do
|
||||||
let(:invites) {
|
let(:invites) {
|
||||||
return [{ email: 'regular@example.com', role: 'regular'},
|
return [{ email: 'regular@example.com', role: 'regular'},
|
||||||
|
|
Loading…
Reference in a new issue