discourse/app/assets/javascripts/admin/addon/templates/components/admin-user-field-item.hbs
Jarek Radosz c3fd91670e
DEV: Update linting setup and fix issues (#17345)
Re-lands #16119 and #17298

* Update eslint-config-discourse
* Update linting workflow
* Prettier-ignore stuff
* Update template-lint config
* Auto-fix template issues
* Fix various template issues
  Mostly incorrect attributes and unused templates
* Prettier js files
* Fix template auto-fix regressions
* Small css tweak

Co-authored-by: Peter Wagenet <peter.wagenet@gmail.com>
2022-07-06 10:37:54 +02:00

63 lines
3.0 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={{action (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="255" />
</AdminFormRow>
{{#if this.bufferedFieldType.hasOptions}}
<AdminFormRow @label="admin.user_fields.options">
<ValueList @values={{this.buffered.options}} @inputType="array" />
</AdminFormRow>
{{/if}}
<AdminFormRow @wrapLabel="true">
<Input @type="checkbox" @checked={{this.buffered.editable}} /> <span>{{i18n "admin.user_fields.editable.title"}}</span>
</AdminFormRow>
<AdminFormRow @wrapLabel="true">
<Input @type="checkbox" @checked={{this.buffered.required}} /> <span>{{i18n "admin.user_fields.required.title"}}</span>
</AdminFormRow>
<AdminFormRow @wrapLabel="true">
<Input @type="checkbox" @checked={{this.buffered.show_on_profile}} /> <span>{{i18n "admin.user_fields.show_on_profile.title"}}</span>
</AdminFormRow>
<AdminFormRow @wrapLabel="true">
<Input @type="checkbox" @checked={{this.buffered.show_on_user_card}} /> <span>{{i18n "admin.user_fields.show_on_user_card.title"}}</span>
</AdminFormRow>
<AdminFormRow @wrapLabel="true">
<Input @type="checkbox" @checked={{this.buffered.searchable}} /> <span>{{i18n "admin.user_fields.searchable.title"}}</span>
</AdminFormRow>
<AdminFormRow>
<DButton @action={{action "save"}} @class="btn-primary save" @icon="check" @label="admin.user_fields.save" />
<DButton @action={{action "cancel"}} @class="btn-danger cancel" @icon="times" @label="admin.user_fields.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={{action "edit"}} @class="btn-default edit" @icon="pencil-alt" @label="admin.user_fields.edit" />
<DButton @action={{this.destroyAction}} @actionParam={{this.userField}} @class="btn-danger cancel" @icon="far-trash-alt" @label="admin.user_fields.delete" />
<DButton @action={{this.moveUpAction}} @actionParam={{this.userField}} @class="btn-default" @icon="arrow-up" @disabled={{this.cantMoveUp}} />
<DButton @action={{this.moveDownAction}} @actionParam={{this.userField}} @class="btn-default" @icon="arrow-down" @disabled={{this.cantMoveDown}} />
</div>
</div>
<div class="row">{{this.flags}}</div>
{{/if}}
</div>