0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-24 10:20:28 +01:00
discourse-custom-wizard/assets/javascripts/discourse/components/wizard-custom-field.hbs

308 Zeilen
7,5 KiB
Handlebars

2024-11-22 16:45:50 +01:00
{{#if this.showUndo}}
2023-07-10 08:55:54 +02:00
{{d-button
action=(action "undoChanges")
2024-11-22 16:45:50 +01:00
icon=this.undoIcon
label=this.undoKey
2023-07-10 08:55:54 +02:00
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
2024-11-22 16:45:50 +01:00
imageUrl=this.field.image
2023-07-10 08:55:54 +02:00
onUploadDone=(action "imageUploadDone")
onUploadDeleted=(action "imageUploadDeleted")
type="wizard-field-image"
class="no-repeat contain-image"
2024-11-22 16:45:50 +01:00
id=(concat "wizard-field-" this.field.id "-image-upload")
2023-07-10 08:55:54 +02:00
}}
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.type"}}</label>
</div>
<div class="setting-value">
{{wizard-subscription-selector
2024-11-22 16:45:50 +01:00
value=this.field.type
2023-07-10 08:55:54 +02:00
feature="field"
attribute="type"
onChange=(action "changeType")
2024-11-22 16:45:50 +01:00
wizard=this.wizard
2023-07-10 08:55:54 +02:00
options=(hash none="admin.wizard.select_type")
}}
</div>
</div>
2024-11-22 16:45:50 +01:00
{{wizard-message key=this.messageKey url=this.messageUrl component="field"}}
2023-07-10 08:55:54 +02:00
2024-11-22 16:45:50 +01:00
{{#if this.isTextType}}
2023-07-10 08:55:54 +02:00
<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}}
2024-11-22 16:45:50 +01:00
{{#if this.isComposerPreview}}
2023-07-10 08:55:54 +02:00
<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}}
2024-11-22 16:45:50 +01:00
{{#if this.isUpload}}
2023-07-10 08:55:54 +02:00
<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}}
2024-11-22 16:45:50 +01:00
{{#if this.showLimit}}
2023-07-10 08:55:54 +02:00
<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}}
2024-11-22 16:45:50 +01:00
{{#if this.isDateTime}}
2023-07-10 08:55:54 +02:00
<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}}
2024-11-22 16:45:50 +01:00
{{#if this.showPrefill}}
2023-07-10 08:55:54 +02:00
<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
2024-11-22 16:45:50 +01:00
inputs=this.field.prefill
2023-07-10 08:55:54 +02:00
property="prefill"
onUpdate=(action "mappedFieldUpdated")
2024-11-22 16:45:50 +01:00
options=this.prefillOptions
2023-07-10 08:55:54 +02:00
}}
</div>
</div>
{{/if}}
2024-11-22 16:45:50 +01:00
{{#if this.showContent}}
2023-07-10 08:55:54 +02:00
<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
2024-11-22 16:45:50 +01:00
inputs=this.field.content
2023-07-10 08:55:54 +02:00
property="content"
onUpdate=(action "mappedFieldUpdated")
2024-11-22 16:45:50 +01:00
options=this.contentOptions
2023-07-10 08:55:54 +02:00
}}
</div>
</div>
{{/if}}
2024-11-22 16:45:50 +01:00
{{#if this.isTag}}
2023-07-10 08:55:54 +02:00
<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
2024-11-22 16:45:50 +01:00
id=(concat this.field.id "-tag-groups")
tagGroups=this.field.tag_groups
onChange=(action (mut this.field.tag_groups))
2023-07-10 08:55:54 +02:00
}}
</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}}
2024-11-22 16:45:50 +01:00
{{#if this.isTopic}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.category.label"}}</label>
</div>
<div class="setting-value">
<CategoryChooser
@value={{this.field.category}}
@onChangeCategory={{action "changeCategory"}}
@options={{hash
none="admin.wizard.field.category.none"
autoInsertNoneItem=true
}}
/>
</div>
</div>
{{/if}}
2023-07-10 08:55:54 +02:00
{{#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">
2024-11-22 16:45:50 +01:00
{{wizard-mapper inputs=this.field.condition options=this.fieldConditionOptions}}
2023-07-10 08:55:54 +02:00
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.index"}}</label>
</div>
<div class="setting-value">
2024-11-22 16:45:50 +01:00
{{wizard-mapper inputs=this.field.index options=this.fieldIndexOptions}}
2023-07-10 08:55:54 +02:00
</div>
</div>
2024-11-22 16:45:50 +01:00
{{#if this.isCategory}}
2023-07-10 08:55:54 +02:00
<div class="setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.field.property"}}</label>
</div>
<div class="setting-value">
{{combo-box
2024-11-22 16:45:50 +01:00
value=this.field.property
content=this.categoryPropertyTypes
onChange=(action (mut this.field.property))
2023-07-10 08:55:54 +02:00
options=(hash none="admin.wizard.selector.placeholder.property")
}}
</div>
</div>
{{/if}}
2024-11-22 16:45:50 +01:00
{{#if this.validations}}
{{wizard-realtime-validations field=this.field validations=this.validations}}
2023-07-10 08:55:54 +02:00
{{/if}}
{{/wizard-subscription-container}}