From 2ac2c42b06c2f76b6eb17dc630c7fb53aabbd708 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Thu, 5 Dec 2024 13:43:08 +1000 Subject: [PATCH] UX: Rearrange wizard steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reorder steps: * “Your site is ready” from 3 → 4 * “Logos” from 4 → 5 * “Look and feel” from 5 → 3 So the new order goes “Look and feel”, “Your site is ready”, “Logos”, “Boring legal stuff” --- app/assets/stylesheets/wizard.scss | 2 +- lib/wizard/builder.rb | 29 ++++++++++++++++++++++++----- spec/system/wizard_spec.rb | 4 ++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/wizard.scss b/app/assets/stylesheets/wizard.scss index 9882bceabc6..73927ac7f2b 100644 --- a/app/assets/stylesheets/wizard.scss +++ b/app/assets/stylesheets/wizard.scss @@ -190,7 +190,7 @@ body.wizard { } &__sidebar { - width: 170px; + width: 230px; box-sizing: border-box; margin-right: 1em; diff --git a/lib/wizard/builder.rb b/lib/wizard/builder.rb index fcc2bb74792..6ffb989e370 100644 --- a/lib/wizard/builder.rb +++ b/lib/wizard/builder.rb @@ -9,6 +9,20 @@ class Wizard def build return @wizard unless SiteSetting.wizard_enabled? && @wizard.user.try(:staff?) + append_introduction_step + append_privacy_step + append_styling_step + append_ready_step + append_branding_step + append_corporate_step + + DiscourseEvent.trigger(:build_wizard, @wizard) + @wizard + end + + protected + + def append_introduction_step @wizard.append_step("introduction") do |step| step.emoji = "wave" step.description_vars = { base_path: Discourse.base_path } @@ -56,7 +70,9 @@ class Wizard end end end + end + def append_privacy_step @wizard.append_step("privacy") do |step| step.emoji = "hugs" @@ -93,12 +109,16 @@ class Wizard updater.update_setting(:must_approve_users, updater.fields[:must_approve_users] == "yes") end end + end + def append_ready_step @wizard.append_step("ready") do |step| # no form on this page, just info. step.emoji = "rocket" end + end + def append_branding_step @wizard.append_step("branding") do |step| step.emoji = "framed_picture" step.add_field(id: "logo", type: "image", value: SiteSetting.site_logo_url) @@ -112,7 +132,9 @@ class Wizard end end end + end + def append_styling_step @wizard.append_step("styling") do |step| step.emoji = "art" default_theme = Theme.find_by(id: SiteSetting.default_theme_id) @@ -231,7 +253,9 @@ class Wizard updater.refresh_required = true end end + end + def append_corporate_step @wizard.append_step("corporate") do |step| step.emoji = "briefcase" step.description_vars = { base_path: Discourse.base_path } @@ -259,13 +283,8 @@ class Wizard end end end - - DiscourseEvent.trigger(:build_wizard, @wizard) - @wizard end - protected - def replace_setting_value(updater, raw, field_name) old_value = SiteSetting.get(field_name) old_value = field_name if old_value.blank? diff --git a/spec/system/wizard_spec.rb b/spec/system/wizard_spec.rb index 45fc86576c0..1a727561f7a 100644 --- a/spec/system/wizard_spec.rb +++ b/spec/system/wizard_spec.rb @@ -14,12 +14,12 @@ describe "Wizard", type: :system do wizard_page.go_to_next_step expect(wizard_page).to be_on_step("privacy") wizard_page.go_to_next_step + expect(wizard_page).to be_on_step("styling") + wizard_page.go_to_next_step expect(wizard_page).to be_on_step("ready") wizard_page.click_configure_more expect(wizard_page).to be_on_step("branding") wizard_page.go_to_next_step - expect(wizard_page).to be_on_step("styling") - wizard_page.go_to_next_step expect(wizard_page).to be_on_step("corporate") wizard_page.click_jump_in expect(page).to have_current_path("/latest")