Skip to content

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

UX: Minor cosmetic fixes to the wizard (#11172)

Penar Musaraj57bd85af31fe
diff --git a/app/assets/javascripts/wizard/templates/components/wizard-field.hbs b/app/assets/javascripts/wizard/templates/components/wizard-field.hbs
index 86745dc9fec..e347fb80b3f 100644
--- a/app/assets/javascripts/wizard/templates/components/wizard-field.hbs
+++ b/app/assets/javascripts/wizard/templates/components/wizard-field.hbs
@@ -1,5 +1,11 @@
<label for={{field.id}}>
- <span class="label-value">{{field.label}}</span>
+ <span class="label-value">
+ {{field.label}}
+
+ {{#if field.required}}
+ <span class="field-required">*</span>
+ {{/if}}
+ </span>
{{#if field.description}}
<div class="field-description">{{html-safe field.description}}</div>
@@ -13,3 +19,7 @@
{{#if field.errorDescription}}
<div class="field-error-description">{{html-safe field.errorDescription}}</div>
{{/if}}
+
+{{#if field.extra_description}}
+ <div class="field-extra-description">{{html-safe field.extra_description}}</div>
+{{/if}}
diff --git a/app/assets/stylesheets/wizard.scss b/app/assets/stylesheets/wizard.scss
index 97ef15dbcdc..17b4150aadf 100644
--- a/app/assets/stylesheets/wizard.scss
+++ b/app/assets/stylesheets/wizard.scss
@@ -1189,6 +1189,22 @@ body.wizard {
margin-top: 0.5em;
}
+ .field-extra-description {
+ margin-top: 0.5em;
+ color: var(--primary-high);
+ }
+
+ .field-required {
+ display: none;
+ }
+
+ &.text-field {
+ .field-required {
+ display: inline;
+ color: var(--danger);
+ }
+ }
+
margin-bottom: 2em;
}
}
diff --git a/app/serializers/wizard_field_serializer.rb b/app/serializers/wizard_field_serializer.rb
index cc937556f79..6d9617fd65f 100644
--- a/app/serializers/wizard_field_serializer.rb
+++ b/app/serializers/wizard_field_serializer.rb
@@ -2,7 +2,7 @@
class WizardFieldSerializer < ApplicationSerializer
- attributes :id, :type, :required, :value, :label, :placeholder, :description
+ attributes :id, :type, :required, :value, :label, :placeholder, :description, :extra_description
has_many :choices, serializer: WizardFieldChoiceSerializer, embed: :objects
def id
@@ -60,4 +60,12 @@ class WizardFieldSerializer < ApplicationSerializer
description.present?
end
+ def extra_description
+ translate("extra_description", base_path: Discourse.base_path)
+ end
+
+ def include_extra_description?
+ extra_description.present?
+ end
+
end
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 81b56bb6ba0..6e5a5a0a184 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -4663,6 +4663,7 @@ en:
</ul>
<p>Your welcome topic is the first thing new arrivals will read. Think of it as your <b>one paragraph</b> 'elevator pitch' or 'mission statement'. </p>"
one_paragraph: "Please restrict your welcome message to one paragraph."
+ extra_description: "If you are not sure, you can skip this step and write your welcome topic later."
privacy:
title: "Access"
diff --git a/lib/wizard/builder.rb b/lib/wizard/builder.rb
index b6f3b416714..2dd469431b5 100644
--- a/lib/wizard/builder.rb
+++ b/lib/wizard/builder.rb
@@ -39,7 +39,7 @@ class Wizard
@wizard.append_step('forum-title') do |step|
step.add_field(id: 'title', type: 'text', required: true, value: SiteSetting.title)
- step.add_field(id: 'site_description', type: 'text', required: true, value: SiteSetting.site_description)
+ step.add_field(id: 'site_description', type: 'text', required: false, value: SiteSetting.site_description)
step.add_field(id: 'short_site_description', type: 'text', required: false, value: SiteSetting.short_site_description)
step.on_update do |updater|
@@ -58,8 +58,7 @@ class Wizard
step.disabled = true
step.description_vars = { topic_title: I18n.t("discourse_welcome_topic.title") }
else
- step.add_field(id: 'welcome', type: 'textarea', required: true, value: introduction.get_summary)
-
+ step.add_field(id: 'welcome', type: 'textarea', required: false, value: introduction.get_summary)
step.on_update do |updater|
value = updater.fields[:welcome].strip