Skip to content

A platform for community discussion. Free, open, simple.

DEV: Wizard step tweaks (#32304)

Ted Johanssonfc6aaa3e49d0
diff --git a/app/assets/javascripts/discourse/app/static/wizard/components/wizard-step.gjs b/app/assets/javascripts/discourse/app/static/wizard/components/wizard-step.gjs
index bce36e6e192..b7c6630b782 100644
--- a/app/assets/javascripts/discourse/app/static/wizard/components/wizard-step.gjs
+++ b/app/assets/javascripts/discourse/app/static/wizard/components/wizard-step.gjs
@@ -69,10 +69,6 @@ export default class WizardStepComponent extends Component {
return isReady && !this.isFinalStep;
}
- get showConfigureMore() {
- return this.id === "ready";
- }
-
get showJumpInButton() {
return this.id === "ready" || this.isFinalStep;
}
@@ -284,15 +280,6 @@ export default class WizardStepComponent extends Component {
>
{{i18n "wizard.finish"}}
</button>
- {{else if this.showConfigureMore}}
- <button
- {{on "click" this.nextStep}}
- disabled={{this.saving}}
- type="button"
- class="wizard-container__button configure-more"
- >
- {{i18n "wizard.configure_more"}}
- </button>
{{/if}}
{{#if this.showJumpInButton}}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/wizard-test.js b/app/assets/javascripts/discourse/tests/acceptance/wizard-test.js
index ba962ba7889..de8bcaf0543 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/wizard-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/wizard-test.js
@@ -44,9 +44,6 @@ acceptance("Wizard", function (needs) {
assert
.dom(".wizard-container__button.jump-in")
.doesNotExist("First step: no jump-in button");
- assert
- .dom(".wizard-container__button.configure-more")
- .doesNotExist("First step: no configure-more button");
assert
.dom(".wizard-container__button.finish")
.doesNotExist("First step: no finish button");
@@ -81,9 +78,6 @@ acceptance("Wizard", function (needs) {
assert
.dom(".wizard-container__button.jump-in")
.doesNotExist("Pre-ready step: no jump-in button");
- assert
- .dom(".wizard-container__button.configure-more")
- .doesNotExist("Pre-ready step: no configure-more button");
assert
.dom(".wizard-container__button.finish")
.doesNotExist("Pre-ready step: no finish button");
@@ -103,69 +97,12 @@ acceptance("Wizard", function (needs) {
assert
.dom(".wizard-container__button.jump-in")
.exists("Ready step: jump-in button");
- assert
- .dom(".wizard-container__button.configure-more")
- .exists("Ready step: configure-more button");
assert
.dom(".wizard-container__button.finish")
.doesNotExist("Ready step: no finish button");
- // continue on to optional steps
- await click(".wizard-container__button.configure-more");
- assert.dom(".wizard-container__step.optional").exists("step: optional");
-
- // Post-ready: back, next and finish buttons
- assert.dom(".wizard-canvas").doesNotExist("Post-ready step: no confetti");
- assert
- .dom(".wizard-container__button.back")
- .exists("Post-ready step: back button");
- assert
- .dom(".wizard-container__button.next")
- .exists("Post-ready step: next button");
- assert
- .dom(".wizard-container__button.jump-in")
- .doesNotExist("Post-ready step: no jump-in button");
- assert
- .dom(".wizard-container__button.configure-more")
- .doesNotExist("Post-ready step: no configure-more button");
- assert
- .dom(".wizard-container__button.finish")
- .exists("Post-ready step: finish button");
-
- // finish early, does not save/validate
- await click(".wizard-container__button.finish");
- assert.strictEqual(
- currentURL(),
- "/latest",
- "it should transition to the homepage"
- );
-
- await visit("/wizard/steps/optional");
- assert.dom(".wizard-container__step.optional").exists("step: optional");
-
- // Post-ready: back, next and finish buttons
- assert.dom(".wizard-canvas").doesNotExist("Post-ready step: no confetti");
- assert
- .dom(".wizard-container__button.back")
- .exists("Post-ready step: back button");
- assert
- .dom(".wizard-container__button.next")
- .exists("Post-ready step: next button");
- assert
- .dom(".wizard-container__button.jump-in")
- .doesNotExist("Post-ready step: no jump-in button");
- assert
- .dom(".wizard-container__button.configure-more")
- .doesNotExist("Post-ready step: no configure-more button");
- assert
- .dom(".wizard-container__button.finish")
- .exists("Post-ready step: finish button");
-
- await click(".wizard-container__button.primary.next");
- assert.dom(".wizard-container__step.corporate").exists("step: corporate");
-
// Final step: back and jump-in buttons
- assert.dom(".wizard-canvas").doesNotExist("Finish step: no confetti");
+ assert.dom(".wizard-canvas").exists("Finish step: no confetti");
assert
.dom(".wizard-container__button.back")
.exists("Finish step: back button");
@@ -175,49 +112,9 @@ acceptance("Wizard", function (needs) {
assert
.dom(".wizard-container__button.jump-in")
.exists("Finish step: jump-in button");
- assert
- .dom(".wizard-container__button.configure-more")
- .doesNotExist("Finish step: no configure-more button");
- assert
- .dom(".wizard-container__button.finish")
- .doesNotExist("Finish step: no finish button");
-
- assert
- .dom(".wizard-container__text-input#company_name")
- .exists("went to the next step");
- assert
- .dom(".wizard-container__preview")
- .exists("renders the component field");
- assert.dom(".wizard-container__step-title").doesNotExist();
-
- await click(".wizard-container__button.back");
- assert.dom(".wizard-container__step.optional").exists("step: optional");
-
- // Post-ready: back, next and finish buttons
- assert.dom(".wizard-canvas").doesNotExist("Post-ready step: no confetti");
- assert
- .dom(".wizard-container__button.back")
- .exists("Post-ready step: back button");
- assert
- .dom(".wizard-container__button.next")
- .exists("Post-ready step: next button");
- assert
- .dom(".wizard-container__button.jump-in")
- .doesNotExist("Post-ready step: no jump-in button");
- assert
- .dom(".wizard-container__button.configure-more")
- .doesNotExist("Post-ready step: no configure-more button");
- assert
- .dom(".wizard-container__button.finish")
- .exists("Post-ready step: finish button");
-
- assert.dom(".wizard-container__step-title").exists("shows the step title");
-
- await click(".wizard-container__button.next");
- assert.dom(".wizard-container__step.corporate").exists("step: optional");
// Final step: back and jump-in buttons
- assert.dom(".wizard-canvas").doesNotExist("Finish step: no confetti");
+ assert.dom(".wizard-canvas").exists("Finish step: no confetti");
assert
.dom(".wizard-container__button.back")
.exists("Finish step: back button");
@@ -227,23 +124,9 @@ acceptance("Wizard", function (needs) {
assert
.dom(".wizard-container__button.jump-in")
.exists("Finish step: jump-in button");
- assert
- .dom(".wizard-container__button.configure-more")
- .doesNotExist("Finish step: no configure-more button");
- assert
- .dom(".wizard-container__button.finish")
- .doesNotExist("Finish step: no finish button");
- // server validation fail
- await fillIn("input#company_name", "Server Fail");
await click(".wizard-container__button.jump-in");
- assert
- .dom(".invalid #company_name")
- .exists("highlights the field with error");
- assert.dom(".wizard-container__field .error").exists("shows the error");
- await fillIn("input#company_name", "Foo Bar");
- await click(".wizard-container__button.jump-in");
assert.strictEqual(
currentURL(),
"/latest",
diff --git a/app/assets/stylesheets/wizard.scss b/app/assets/stylesheets/wizard.scss
index a57bf14c5e8..0f113107582 100644
--- a/app/assets/stylesheets/wizard.scss
+++ b/app/assets/stylesheets/wizard.scss
@@ -427,21 +427,6 @@ body.wizard {
background-color: var(--tertiary-low);
}
- &__button.configure-more {
- margin-right: 1em;
- background-color: transparent;
- color: var(--tertiary);
-
- @include breakpoint("mobile-extra-large") {
- order: 2;
- }
- }
-
- &__button.configure-more:hover {
- background-color: transparent;
- color: var(--primary);
- }
-
&__button.jump-in {
&:hover {
background-color: var(--primary-300);
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 06db6a4b55b..62996faf260 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -5484,7 +5484,7 @@ en:
label: "Category boxes"
description: "Displays the categories and their description in a grid, ideal for members to see an overview of the sub-communities of your site"
- logo_and_fonts:
+ branding:
title: "Site logo"
fields:
logo:
diff --git a/lib/wizard/builder.rb b/lib/wizard/builder.rb
index e7d44f94632..a59e57065f6 100644
--- a/lib/wizard/builder.rb
+++ b/lib/wizard/builder.rb
@@ -14,9 +14,8 @@ class Wizard
append_introduction_step
append_privacy_step
append_styling_step
- append_ready_step
append_branding_step
- append_corporate_step
+ append_ready_step
DiscourseEvent.trigger(:build_wizard, @wizard)
@wizard
@@ -305,36 +304,6 @@ class Wizard
end
end
- def append_corporate_step
- @wizard.append_step("corporate") do |step|
- step.emoji = "briefcase"
- step.description_vars = { base_path: Discourse.base_path }
- step.add_field(id: "company_name", type: "text", value: SiteSetting.company_name)
- step.add_field(id: "governing_law", type: "text", value: SiteSetting.governing_law)
- step.add_field(id: "contact_url", type: "text", value: SiteSetting.contact_url)
- step.add_field(id: "city_for_disputes", type: "text", value: SiteSetting.city_for_disputes)
- step.add_field(id: "contact_email", type: "text", value: SiteSetting.contact_email)
-
- step.on_update do |updater|
- update_tos do |raw|
- replace_setting_value(updater, raw, "company_name")
- replace_setting_value(updater, raw, "governing_law")
- replace_setting_value(updater, raw, "city_for_disputes")
- end
-
- if updater.errors.blank?
- updater.apply_settings(
- :company_name,
- :governing_law,
- :city_for_disputes,
- :contact_url,
- :contact_email,
- )
- end
- end
- end
- end
-
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/lib/wizard/step_updater_spec.rb b/spec/lib/wizard/step_updater_spec.rb
index 42a0f763479..369e00b422a 100644
--- a/spec/lib/wizard/step_updater_spec.rb
+++ b/spec/lib/wizard/step_updater_spec.rb
@@ -410,52 +410,4 @@ RSpec.describe Wizard::StepUpdater do
expect(SiteSetting.logo_small).to eq(upload2)
end
end
-
- describe "corporate" do
- it "updates the fields properly" do
- p = Fabricate(:post, raw: "company_name - governing_law - city_for_disputes template")
- SiteSetting.tos_topic_id = p.topic_id
-
- updater =
- wizard.create_updater(
- "corporate",
- company_name: "ACME, Inc.",
- governing_law: "New Jersey law",
- contact_url: "http://example.com/custom-contact-url",
- city_for_disputes: "Fairfield, New Jersey",
- contact_email: "[email protected]",
- )
- updater.update
- expect(updater).to be_success
- expect(SiteSetting.company_name).to eq("ACME, Inc.")
- expect(SiteSetting.governing_law).to eq("New Jersey law")
- expect(SiteSetting.contact_url).to eq("http://example.com/custom-contact-url")
- expect(SiteSetting.city_for_disputes).to eq("Fairfield, New Jersey")
- expect(SiteSetting.contact_email).to eq("[email protected]")
-
- # Should update the TOS topic
- raw = Post.where(topic_id: SiteSetting.tos_topic_id, post_number: 1).pick(:raw)
- expect(raw).to eq("ACME, Inc. - New Jersey law - Fairfield, New Jersey template")
-
- # Can update the TOS topic again
- updater =
- wizard.create_updater(
- "corporate",
- company_name: "Pied Piper Inc",
- governing_law: "California law",
- city_for_disputes: "San Francisco, California",
- )
- updater.update
- raw = Post.where(topic_id: SiteSetting.tos_topic_id, post_number: 1).pick(:raw)
- expect(raw).to eq("Pied Piper Inc - California law - San Francisco, California template")
-
- # Can update the TOS to nothing
- updater = wizard.create_updater("corporate", {})
- updater.update
- raw = Post.where(topic_id: SiteSetting.tos_topic_id, post_number: 1).pick(:raw)
- expect(raw).to eq("company_name - governing_law - city_for_disputes template")
-
- expect(wizard.completed_steps?("corporate")).to eq(true)
- end
- end
end
diff --git a/spec/serializers/wizard_serializer_spec.rb b/spec/serializers/wizard_serializer_spec.rb
index 0c14332e6ce..988a8f1acc0 100644
--- a/spec/serializers/wizard_serializer_spec.rb
+++ b/spec/serializers/wizard_serializer_spec.rb
@@ -55,7 +55,7 @@ RSpec.describe WizardSerializer do
steps = json["wizard"]["steps"]
expect(steps.first["id"]).to eq("introduction")
- expect(steps.last["id"]).to eq("corporate")
+ expect(steps.last["id"]).to eq("ready")
privacy_step = steps.find { |s| s["id"] == "privacy" }
expect(privacy_step).to_not be_nil
diff --git a/spec/system/page_objects/pages/wizard.rb b/spec/system/page_objects/pages/wizard.rb
index 85749ed50b7..cab6d40bd8f 100644
--- a/spec/system/page_objects/pages/wizard.rb
+++ b/spec/system/page_objects/pages/wizard.rb
@@ -31,10 +31,6 @@ module PageObjects
find(".wizard-container__button.jump-in").click
end
- def click_configure_more
- find(".wizard-container__button.configure-more").click
- end
-
def go_to_next_step
find(".wizard-container__button.next").click
end
diff --git a/spec/system/wizard_spec.rb b/spec/system/wizard_spec.rb
index ba1aaee3bbe..6e2748eb6ab 100644
--- a/spec/system/wizard_spec.rb
+++ b/spec/system/wizard_spec.rb
@@ -16,11 +16,9 @@ describe "Wizard", type: :system do
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("corporate")
+ expect(wizard_page).to be_on_step("ready")
wizard_page.click_jump_in
expect(page).to have_current_path("/latest")
end
@@ -72,7 +70,7 @@ describe "Wizard", type: :system do
attach_file(file_path_2) { wizard_page.branding_step.click_upload_button("logo-small") }
expect(wizard_page.branding_step).to have_upload("logo-small")
wizard_page.go_to_next_step
- expect(wizard_page).to be_on_step("corporate")
+ expect(wizard_page).to be_on_step("ready")
expect(SiteSetting.logo).to eq(Upload.find_by(original_filename: File.basename(file_path_1)))
expect(SiteSetting.logo_small).to eq(
@@ -91,7 +89,7 @@ describe "Wizard", type: :system do
wizard_page.styling_step.select_homepage_style_option("hot")
wizard_page.go_to_next_step
- expect(wizard_page).to be_on_step("ready")
+ expect(wizard_page).to be_on_step("branding")
expect(Theme.find_default.color_scheme_id).to eq(
ColorScheme.find_by(base_scheme_id: "Dark", via_wizard: true).id,
@@ -117,7 +115,7 @@ describe "Wizard", type: :system do
wizard_page.styling_step.select_heading_font_option("inter")
wizard_page.go_to_next_step
- expect(wizard_page).to be_on_step("ready")
+ expect(wizard_page).to be_on_step("branding")
expect(SiteSetting.base_font).to eq("roboto")
expect(SiteSetting.heading_font).to eq("inter")
@@ -143,31 +141,4 @@ describe "Wizard", type: :system do
expect(page).to have_current_path(topic.url)
end
end
-
- describe "Wizard Step: Corporate" do
- it "lets user configure corporate including governing law and city for disputes" do
- wizard_page.go_to_step("corporate")
- expect(wizard_page).to be_on_step("corporate")
- wizard_page.fill_field("text", "company-name", "ACME")
- wizard_page.fill_field("text", "governing-law", "California")
- wizard_page.fill_field("text", "contact-url", "https://ac.me")
- wizard_page.fill_field("text", "city-for-disputes", "San Francisco")
- wizard_page.fill_field("text", "contact-email", "[email protected]")
- wizard_page.click_jump_in
- expect(page).to have_current_path("/latest")
-
- expect(SiteSetting.company_name).to eq("ACME")
- expect(SiteSetting.governing_law).to eq("California")
- expect(SiteSetting.city_for_disputes).to eq("San Francisco")
- expect(SiteSetting.contact_url).to eq("https://ac.me")
- expect(SiteSetting.contact_email).to eq("[email protected]")
-
- wizard_page.go_to_step("corporate")
- expect(wizard_page).to have_field_with_value("text", "company-name", "ACME")
- expect(wizard_page).to have_field_with_value("text", "governing-law", "California")
- expect(wizard_page).to have_field_with_value("text", "contact-url", "https://ac.me")
- expect(wizard_page).to have_field_with_value("text", "city-for-disputes", "San Francisco")
- expect(wizard_page).to have_field_with_value("text", "contact-email", "[email protected]")
- end
- end
end