0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-23 01:40:29 +01:00
discourse-custom-wizard/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs

289 Zeilen
6,9 KiB
Handlebars

2023-07-10 08:55:54 +02:00
{{#if showUndo}}
{{d-button
action=(action "undoChanges")
icon=undoIcon
label=undoKey
class="undo-changes"
}}
{{/if}}
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.label"}}</label>
</div>
<div class="setting-value">
<Input name="label" @value={{this.field.label}} />
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.required"}}</label>
</div>
<div class="setting-value">
<span>{{i18n "admin.wizard.field.required_label"}}</span>
<Input @type="checkbox" @checked={{this.field.required}} />
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.description"}}</label>
</div>
<div class="setting-value">
<Textarea name="description" @value={{this.field.description}} />
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.image"}}</label>
</div>
<div class="setting-value">
{{uppy-image-uploader
imageUrl=field.image
onUploadDone=(action "imageUploadDone")
onUploadDeleted=(action "imageUploadDeleted")
type="wizard-field-image"
class="no-repeat contain-image"
id=(concat "wizard-field-" field.id "-image-upload")
}}
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.type"}}</label>
</div>
<div class="setting-value">
{{wizard-subscription-selector
value=field.type
feature="field"
attribute="type"
onChange=(action "changeType")
wizard=wizard
options=(hash none="admin.wizard.select_type")
}}
</div>
</div>
{{wizard-message key=messageKey url=messageUrl component="field"}}
{{#if isTextType}}
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.min_length"}}</label>
</div>
<div class="setting-value">
<Input
@type="number"
name="min_length"
@value={{this.field.min_length}}
class="small"
/>
</div>
</div>
<div class="setting full">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.max_length"}}</label>
</div>
<div class="setting-value">
<Input
@type="number"
name="max_length"
@value={{this.field.max_length}}
class="small"
/>
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.char_counter"}}</label>
</div>
<div class="setting-value">
<span>{{i18n "admin.wizard.field.char_counter_placeholder"}}</span>
<Input @type="checkbox" @checked={{this.field.char_counter}} />
</div>
</div>
<div class="setting full">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.field_placeholder"}}</label>
</div>
<div class="setting-value">
<Textarea
name="field_placeholder"
class="medium"
@value={{this.field.placeholder}}
/>
</div>
</div>
{{/if}}
{{#if isComposerPreview}}
<div class="setting full">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.preview_template"}}</label>
</div>
<div class="setting-value">
<Textarea
name="preview-template"
class="preview-template"
@value={{this.field.preview_template}}
/>
</div>
</div>
{{/if}}
{{#if isUpload}}
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.file_types"}}</label>
</div>
<div class="setting-value">
<Input @value={{this.field.file_types}} class="medium" />
</div>
</div>
{{/if}}
{{#if showLimit}}
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.limit"}}</label>
</div>
<div class="setting-value">
<Input @type="number" @value={{this.field.limit}} class="small" />
</div>
</div>
{{/if}}
{{#if isDateTime}}
<div class="setting">
<div class="setting-label">
<label>{{html-safe
(i18n "admin.wizard.field.date_time_format.label")
}}</label>
</div>
<div class="setting-value">
<Input @value={{this.field.format}} class="medium" />
<label>{{html-safe
(i18n "admin.wizard.field.date_time_format.instructions")
}}</label>
</div>
</div>
{{/if}}
{{#if showPrefill}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.prefill"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=field.prefill
property="prefill"
onUpdate=(action "mappedFieldUpdated")
options=prefillOptions
}}
</div>
</div>
{{/if}}
{{#if showContent}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.content"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=field.content
property="content"
onUpdate=(action "mappedFieldUpdated")
options=contentOptions
}}
</div>
</div>
{{/if}}
{{#if isTag}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.tag_groups"}}</label>
</div>
<div class="setting-value">
{{tag-group-chooser
id=(concat field.id "-tag-groups")
tagGroups=field.tag_groups
onChange=(action (mut field.tag_groups))
}}
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.can_create_tag"}}</label>
</div>
<div class="setting-value">
<Input @type="checkbox" @checked={{this.field.can_create_tag}} />
</div>
</div>
{{/if}}
{{#wizard-subscription-container}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.condition"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper inputs=field.condition options=fieldConditionOptions}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.index"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper inputs=field.index options=fieldIndexOptions}}
</div>
</div>
{{#if isCategory}}
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.property"}}</label>
</div>
<div class="setting-value">
{{combo-box
value=field.property
content=categoryPropertyTypes
onChange=(action (mut field.property))
options=(hash none="admin.wizard.selector.placeholder.property")
}}
</div>
</div>
{{/if}}
{{#if validations}}
{{wizard-realtime-validations field=field validations=validations}}
{{/if}}
{{/wizard-subscription-container}}