mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 01:13:43 +08:00
d63f1826fe
We want to allow admins to make new required fields apply to existing users. In order for this to work we need to have a way to make those users fill up the fields on their next page load. This is very similar to how adding a 2FA requirement post-fact works. Users will be redirected to a page where they can fill up the remaining required fields, and until they do that they won't be able to do anything else.
161 lines
4.8 KiB
Handlebars
161 lines
4.8 KiB
Handlebars
<div class="user-field">
|
|
{{#if (or this.isEditing (not this.userField.id))}}
|
|
<AdminFormRow @label="admin.user_fields.type">
|
|
<ComboBox
|
|
@content={{this.fieldTypes}}
|
|
@value={{this.buffered.field_type}}
|
|
@onChange={{fn (mut this.buffered.field_type)}}
|
|
/>
|
|
</AdminFormRow>
|
|
|
|
<AdminFormRow @label="admin.user_fields.name">
|
|
<Input
|
|
@value={{this.buffered.name}}
|
|
class="user-field-name"
|
|
maxlength="255"
|
|
/>
|
|
</AdminFormRow>
|
|
|
|
<AdminFormRow @label="admin.user_fields.description">
|
|
<Input
|
|
@value={{this.buffered.description}}
|
|
class="user-field-desc"
|
|
maxlength="1000"
|
|
/>
|
|
</AdminFormRow>
|
|
|
|
{{#if this.bufferedFieldType.hasOptions}}
|
|
<AdminFormRow @label="admin.user_fields.options">
|
|
<ValueList @values={{this.buffered.options}} @inputType="array" />
|
|
</AdminFormRow>
|
|
{{/if}}
|
|
|
|
<AdminFormRow @label="admin.user_fields.requirement.title">
|
|
<label class="optional">
|
|
<RadioButton
|
|
@value="optional"
|
|
@name="requirement"
|
|
@selection={{this.buffered.requirement}}
|
|
@onChange={{action "changeRequirementType"}}
|
|
/>
|
|
<span>{{i18n "admin.user_fields.requirement.optional.title"}}</span>
|
|
</label>
|
|
|
|
<label class="for_all_users">
|
|
<RadioButton
|
|
@value="for_all_users"
|
|
@name="requirement"
|
|
@selection={{this.buffered.requirement}}
|
|
@onChange={{action "changeRequirementType"}}
|
|
/>
|
|
<div class="label-text">
|
|
<span>{{i18n
|
|
"admin.user_fields.requirement.for_all_users.title"
|
|
}}</span>
|
|
<div class="description">{{i18n
|
|
"admin.user_fields.requirement.for_all_users.description"
|
|
}}</div>
|
|
</div>
|
|
</label>
|
|
|
|
<label class="on_signup">
|
|
<RadioButton
|
|
@value="on_signup"
|
|
@name="requirement"
|
|
@selection={{this.buffered.requirement}}
|
|
@onChange={{action "changeRequirementType"}}
|
|
/>
|
|
<div class="label-text">
|
|
<span>{{i18n "admin.user_fields.requirement.on_signup.title"}}</span>
|
|
<div class="description">{{i18n
|
|
"admin.user_fields.requirement.on_signup.description"
|
|
}}</div>
|
|
</div>
|
|
</label>
|
|
</AdminFormRow>
|
|
|
|
<AdminFormRow @label="admin.user_fields.preferences">
|
|
<label>
|
|
<Input
|
|
@type="checkbox"
|
|
@checked={{this.buffered.editable}}
|
|
disabled={{this.editableDisabled}}
|
|
/>
|
|
<span>{{i18n "admin.user_fields.editable.title"}}</span>
|
|
</label>
|
|
|
|
<label>
|
|
<Input @type="checkbox" @checked={{this.buffered.show_on_profile}} />
|
|
<span>{{i18n "admin.user_fields.show_on_profile.title"}}</span>
|
|
</label>
|
|
|
|
<label>
|
|
<Input @type="checkbox" @checked={{this.buffered.show_on_user_card}} />
|
|
<span>{{i18n "admin.user_fields.show_on_user_card.title"}}</span>
|
|
</label>
|
|
|
|
<label>
|
|
<Input @type="checkbox" @checked={{this.buffered.searchable}} />
|
|
<span>{{i18n "admin.user_fields.searchable.title"}}</span>
|
|
</label>
|
|
</AdminFormRow>
|
|
|
|
<PluginOutlet
|
|
@name="after-admin-user-fields"
|
|
@outletArgs={{hash buffered=this.buffered}}
|
|
/>
|
|
|
|
<AdminFormRow>
|
|
<DButton
|
|
@action={{this.save}}
|
|
@icon="check"
|
|
@label="admin.user_fields.save"
|
|
class="btn-primary save"
|
|
/>
|
|
<DButton
|
|
@action={{this.cancel}}
|
|
@icon="times"
|
|
@label="admin.user_fields.cancel"
|
|
class="btn-danger cancel"
|
|
/>
|
|
</AdminFormRow>
|
|
{{else}}
|
|
<div class="row">
|
|
<div class="form-display">
|
|
<b class="name">{{this.userField.name}}</b>
|
|
<br />
|
|
<span class="description">{{html-safe
|
|
this.userField.description
|
|
}}</span>
|
|
</div>
|
|
<div class="form-display field-type">{{this.fieldName}}</div>
|
|
<div class="form-element controls">
|
|
<DButton
|
|
@action={{this.edit}}
|
|
@icon="pencil-alt"
|
|
@label="admin.user_fields.edit"
|
|
class="btn-default edit"
|
|
/>
|
|
<DButton
|
|
@action={{fn this.destroyAction this.userField}}
|
|
@icon="far-trash-alt"
|
|
@label="admin.user_fields.delete"
|
|
class="btn-danger cancel"
|
|
/>
|
|
<DButton
|
|
@action={{fn this.moveUpAction this.userField}}
|
|
@icon="arrow-up"
|
|
@disabled={{this.cantMoveUp}}
|
|
class="btn-default"
|
|
/>
|
|
<DButton
|
|
@action={{fn this.moveDownAction this.userField}}
|
|
@icon="arrow-down"
|
|
@disabled={{this.cantMoveDown}}
|
|
class="btn-default"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="row user-field-flags">{{this.flags}}</div>
|
|
{{/if}}
|
|
</div> |