mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
UX: Minor cosmetic fixes to the wizard (#11172)
- Does not force users to type a description or a welcome topic - Adds * marker for required text fields (site title and email)
This commit is contained in:
parent
0c2956dd2e
commit
57bd85af31
|
@ -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}}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user