diff --git a/app/assets/stylesheets/wizard.scss b/app/assets/stylesheets/wizard.scss index 9bbf66ffc61..627ae543890 100644 --- a/app/assets/stylesheets/wizard.scss +++ b/app/assets/stylesheets/wizard.scss @@ -618,15 +618,27 @@ body.wizard { &__checkbox-slider:before, &__checkbox-slider:after { content: ""; + display: block; + position: absolute; + } + + &__checkbox-slider:after { + content: "\2713"; // checkmark + color: var(--secondary); + top: 4px; + left: 10px; + @media only screen and (max-device-width: 568px) { + top: 3px; + left: 5px; + font-size: var(--font-down-3); + } } &__checkbox-slider:before { - display: block; background: var(--secondary); border-radius: 50%; width: 24px; height: 24px; - position: absolute; top: 4px; left: 4px; transition: left 0.25s; @@ -661,6 +673,10 @@ body.wizard { top: 2px; } + label .svg-icon { + top: 2px; + } + .wizard-container__image-upload canvas { border: 1px solid rgba(0, 0, 0, 0.2); } diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 21b54dfca4d..a1f73675f27 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -4957,6 +4957,12 @@ en: must_approve_users: placeholder: "Require Approval" extra_description: "Users must be approved by staff" + chat_enabled: + placeholder: "Enable Chat" + extra_description: "Engage with your members in real time" + enable_sidebar: + placeholder: "Enable Sidebar" + extra_description: "Access your favorite spaces with ease" ready: title: "Your Discourse is Ready!" diff --git a/lib/wizard/builder.rb b/lib/wizard/builder.rb index 48ccba0d1c8..9dbeb37ed25 100644 --- a/lib/wizard/builder.rb +++ b/lib/wizard/builder.rb @@ -70,10 +70,28 @@ class Wizard value: SiteSetting.must_approve_users ) + if defined?(::Chat) + step.add_field( + id: 'chat_enabled', + type: 'checkbox', + icon: 'comment', + value: SiteSetting.chat_enabled + ) + end + + step.add_field( + id: 'enable_sidebar', + type: 'checkbox', + icon: 'bars', + value: SiteSetting.navigation_menu == NavigationMenuSiteSetting::SIDEBAR + ) + step.on_update do |updater| updater.update_setting(:login_required, updater.fields[:login_required]) updater.update_setting(:invite_only, updater.fields[:invite_only]) updater.update_setting(:must_approve_users, updater.fields[:must_approve_users]) + updater.update_setting(:chat_enabled, updater.fields[:chat_enabled]) if defined?(::Chat) + updater.update_setting(:navigation_menu, updater.fields[:enable_sidebar]) end end diff --git a/lib/wizard/step_updater.rb b/lib/wizard/step_updater.rb index c7eef71b89f..a3e7d79f5ab 100644 --- a/lib/wizard/step_updater.rb +++ b/lib/wizard/step_updater.rb @@ -37,6 +37,10 @@ class Wizard value = Upload.get_from_url(value) || '' end + if id == :navigation_menu + value = value.to_s == "true" ? NavigationMenuSiteSetting::SIDEBAR : NavigationMenuSiteSetting::HEADER_DROPDOWN + end + SiteSetting.set_and_log(id, value, @current_user) if SiteSetting.get(id) != value end diff --git a/spec/lib/wizard/step_updater_spec.rb b/spec/lib/wizard/step_updater_spec.rb index 9a6e41dddd5..9dc65a98c7c 100644 --- a/spec/lib/wizard/step_updater_spec.rb +++ b/spec/lib/wizard/step_updater_spec.rb @@ -44,22 +44,36 @@ RSpec.describe Wizard::StepUpdater do describe "privacy" do it "updates to open correctly" do - updater = wizard.create_updater('privacy', login_required: false, invite_only: false, must_approve_users: false) + updater = wizard.create_updater( + 'privacy', + login_required: false, + invite_only: false, + must_approve_users: false, + enable_sidebar: false + ) updater.update expect(updater.success?).to eq(true) expect(SiteSetting.login_required?).to eq(false) expect(SiteSetting.invite_only?).to eq(false) expect(SiteSetting.must_approve_users?).to eq(false) + expect(SiteSetting.navigation_menu).to eq(NavigationMenuSiteSetting::HEADER_DROPDOWN) expect(wizard.completed_steps?('privacy')).to eq(true) end it "updates to private correctly" do - updater = wizard.create_updater('privacy', login_required: true, invite_only: true, must_approve_users: true) + updater = wizard.create_updater( + 'privacy', + login_required: true, + invite_only: true, + must_approve_users: true, + enable_sidebar: true + ) updater.update expect(updater.success?).to eq(true) expect(SiteSetting.login_required?).to eq(true) expect(SiteSetting.invite_only?).to eq(true) expect(SiteSetting.must_approve_users?).to eq(true) + expect(SiteSetting.navigation_menu).to eq(NavigationMenuSiteSetting::SIDEBAR) expect(wizard.completed_steps?('privacy')).to eq(true) end end diff --git a/spec/lib/wizard/wizard_builder_spec.rb b/spec/lib/wizard/wizard_builder_spec.rb index 38572689cf9..edb3352b721 100644 --- a/spec/lib/wizard/wizard_builder_spec.rb +++ b/spec/lib/wizard/wizard_builder_spec.rb @@ -75,19 +75,30 @@ RSpec.describe Wizard::Builder do SiteSetting.login_required = true SiteSetting.invite_only = false SiteSetting.must_approve_users = true + SiteSetting.chat_enabled = true if defined?(::Chat) + SiteSetting.navigation_menu = NavigationMenuSiteSetting::SIDEBAR fields = privacy_step.fields login_required_field = fields.first invite_only_field = fields.second - must_approve_users_field = fields.last + must_approve_users_field = fields.third + chat_enabled_field = fields.second_to_last if defined?(::Chat) + navigation_menu_field = fields.last - expect(fields.length).to eq(3) + count = defined?(::Chat) ? 5 : 4 + expect(fields.length).to eq(count) expect(login_required_field.id).to eq('login_required') expect(login_required_field.value).to eq(true) expect(invite_only_field.id).to eq('invite_only') expect(invite_only_field.value).to eq(false) expect(must_approve_users_field.id).to eq('must_approve_users') expect(must_approve_users_field.value).to eq(true) + if defined?(::Chat) + expect(chat_enabled_field.id).to eq('chat_enabled') + expect(chat_enabled_field.value).to eq(true) + end + expect(navigation_menu_field.id).to eq('enable_sidebar') + expect(navigation_menu_field.value).to eq(true) end end