FEATURE: Separate base and heading font site_settings (#10807)

Allows site administrators to pick different fonts for headings in the wizard and in their site settings. Also correctly displays the header logos in wizard previews.
This commit is contained in:
Penar Musaraj
2020-10-05 13:40:41 -04:00
committed by GitHub
parent bdfb370f19
commit a4356b99af
25 changed files with 171 additions and 105 deletions

View File

@ -210,18 +210,22 @@ class Wizard
end
@wizard.append_step('fonts') do |step|
field = step.add_field(
id: 'font_previews',
type: 'component',
value: SiteSetting.base_font
)
body_font = step.add_field(id: 'body_font', type: 'dropdown', value: SiteSetting.base_font)
heading_font = step.add_field(id: 'heading_font', type: 'dropdown', value: SiteSetting.heading_font)
DiscourseFonts.fonts.each do |font|
field.add_choice(font[:key], data: { class: font[:key].tr("_", "-"), name: font[:name] })
body_font.add_choice(font[:key], label: font[:name])
heading_font.add_choice(font[:key], label: font[:name])
end
step.add_field(
id: 'font_preview',
type: 'component'
)
step.on_update do |updater|
updater.update_setting(:base_font, updater.fields[:font_previews])
updater.update_setting(:base_font, updater.fields[:body_font])
updater.update_setting(:heading_font, updater.fields[:heading_font])
end
end