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

244 Zeilen
6,2 KiB
Handlebars

2020-04-20 11:41:13 +02:00
{{#if showUndo}}
{{d-button
action="undoChanges"
icon=undoIcon
label=undoKey
class="undo-changes"}}
{{/if}}
2017-10-07 04:27:38 +02:00
<div class="setting">
<div class="setting-label">
2020-03-30 01:53:28 +02:00
<label>{{i18n 'admin.wizard.field.label'}}</label>
2017-10-07 04:27:38 +02:00
</div>
<div class="setting-value">
2020-03-30 01:53:28 +02:00
{{input name="label" value=field.label}}
2017-10-13 15:02:34 +02:00
</div>
</div>
<div class="setting">
<div class="setting-label">
2020-04-02 11:29:22 +02:00
<label>{{i18n 'admin.wizard.field.required'}}</label>
2017-10-13 15:02:34 +02:00
</div>
2020-04-02 11:29:22 +02:00
2017-10-13 15:02:34 +02:00
<div class="setting-value">
2020-04-02 11:29:22 +02:00
<span>{{i18n 'admin.wizard.field.required_label'}}</span>
{{input type='checkbox' checked=field.required}}
2017-10-07 04:27:38 +02:00
</div>
</div>
2017-10-06 04:59:02 +02:00
<div class="setting">
<div class="setting-label">
2020-04-02 11:29:22 +02:00
<label>{{i18n 'admin.wizard.field.description'}}</label>
2017-09-23 04:34:07 +02:00
</div>
2017-10-06 04:59:02 +02:00
<div class="setting-value">
2020-04-02 11:29:22 +02:00
{{textarea name="description" value=field.description}}
2017-09-23 04:34:07 +02:00
</div>
2017-10-06 04:59:02 +02:00
</div>
<div class="setting">
<div class="setting-label">
2020-04-02 11:29:22 +02:00
<label>{{i18n 'admin.wizard.field.image'}}</label>
2017-10-06 04:59:02 +02:00
</div>
<div class="setting-value">
2020-04-02 11:29:22 +02:00
{{image-uploader
imageUrl=field.image
onUploadDone=(action "imageUploadDone")
onUploadDeleted=(action "imageUploadDeleted")
type="wizard-step"
class="no-repeat contain-image"}}
2017-10-06 04:59:02 +02:00
</div>
</div>
<div class="setting">
<div class="setting-label">
2020-03-30 01:53:28 +02:00
<label>{{i18n 'admin.wizard.type'}}</label>
2017-10-06 04:59:02 +02:00
</div>
2020-03-30 01:53:28 +02:00
2017-10-06 04:59:02 +02:00
<div class="setting-value">
2020-02-02 11:42:05 +01:00
{{combo-box
value=field.type
2020-04-08 04:52:07 +02:00
content=fieldTypes
2020-04-20 11:41:13 +02:00
onChange=(action "changeType")
2020-03-22 07:47:56 +01:00
options=(hash
2020-04-20 13:40:32 +02:00
none="admin.wizard.select_type"
2020-03-22 07:47:56 +01:00
)}}
2017-09-23 04:34:07 +02:00
</div>
2017-10-06 04:59:02 +02:00
</div>
2020-04-20 13:40:32 +02:00
{{wizard-message
key=messageKey
url=messageUrl
component='field'}}
2021-01-12 08:33:20 +01:00
{{#if isTextType}}
2017-10-13 15:02:34 +02:00
<div class="setting">
<div class="setting-label">
2020-03-30 01:53:28 +02:00
<label>{{i18n 'admin.wizard.field.min_length'}}</label>
2017-10-13 15:02:34 +02:00
</div>
2020-03-30 01:53:28 +02:00
2017-10-13 15:02:34 +02:00
<div class="setting-value">
2020-04-13 14:17:22 +02:00
{{input
type="number"
name="min_length"
value=field.min_length
class="small"}}
2017-10-13 15:02:34 +02:00
</div>
</div>
2020-12-08 08:19:08 +01:00
<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=field.max_length
class="small"}}
</div>
</div>
2021-05-10 08:46:55 +02:00
{{!--
/* learning_step
* unit: custom_wizard:templates_and_builder
* type: step
* number: 1
* title: Add the attribute to the template
* description: First, add a new setting block to allow the site admin to
* administer how the attribute will work. Here we can see the
* controls for the Character Counter field attribute. Note
* the attribute is only available for text type fields (see
* isTextType conditional above this block). Note the
* consistent use of the ``setting``, ``setting-label`` and
* ``setting-value`` HTML structure throughout this component,
* and other Custom Wizard admin components.
*/
--}}
<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=field.char_counter}}
</div>
</div>
2017-10-13 15:02:34 +02:00
{{/if}}
2019-07-19 05:47:17 +02:00
{{#if isUpload}}
<div class="setting">
<div class="setting-label">
2020-03-30 01:53:28 +02:00
<label>{{i18n 'admin.wizard.field.file_types'}}</label>
2019-07-19 05:47:17 +02:00
</div>
2020-03-30 01:53:28 +02:00
2019-07-19 05:47:17 +02:00
<div class="setting-value">
2020-04-14 01:39:21 +02:00
{{input value=field.file_types class="medium"}}
2019-07-19 05:47:17 +02:00
</div>
</div>
{{/if}}
2020-04-08 04:52:07 +02:00
{{#if showLimit}}
2020-03-30 01:53:28 +02:00
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.limit'}}</label>
</div>
<div class="setting-value">
2020-04-13 14:17:22 +02:00
{{input type="number" value=field.limit class="small"}}
2020-03-30 01:53:28 +02:00
</div>
</div>
{{/if}}
2020-07-16 05:26:56 +02:00
{{#if isDateTime}}
<div class="setting">
<div class="setting-label">
<label>{{{i18n 'admin.wizard.field.date_time_format.label'}}}</label>
</div>
<div class="setting-value">
{{input value=field.format class="medium"}}
<label>{{{i18n 'admin.wizard.field.date_time_format.instructions'}}}</label>
</div>
</div>
{{/if}}
2020-04-14 07:46:06 +02:00
{{#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
2020-04-20 11:41:13 +02:00
property='prefill'
onUpdate=(action 'mappedFieldUpdated')
2020-04-14 07:46:06 +02:00
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
2020-04-20 11:41:13 +02:00
property='content'
onUpdate=(action 'mappedFieldUpdated')
2020-04-14 07:46:06 +02:00
options=contentOptions}}
</div>
</div>
{{/if}}
2020-04-20 13:40:32 +02:00
{{#if showAdvanced}}
{{wizard-advanced-toggle showAdvanced=field.showAdvanced}}
2020-04-02 07:21:57 +02:00
2020-04-20 13:40:32 +02:00
{{#if field.showAdvanced}}
<div class="advanced-settings">
{{#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}}
2020-04-05 03:37:09 +02:00
<div class="setting">
<div class="setting-label">
2020-04-20 13:40:32 +02:00
<label>{{i18n 'admin.wizard.translation'}}</label>
2020-04-02 07:21:57 +02:00
</div>
2020-04-20 13:40:32 +02:00
<div class="setting-value medium">
{{input
name="key"
value=field.key
class="medium"
placeholderKey="admin.wizard.translation_placeholder"}}
2020-04-02 07:21:57 +02:00
</div>
2020-04-05 03:37:09 +02:00
</div>
2020-04-20 13:40:32 +02:00
2021-02-11 14:52:09 +01:00
{{#if validations}}
2021-02-13 01:58:38 +01:00
{{wizard-realtime-validations field=field validations=validations}}
2021-02-11 14:52:09 +01:00
{{/if}}
2020-03-24 10:35:46 +01:00
</div>
2020-04-20 13:40:32 +02:00
{{/if}}
2020-03-24 10:35:46 +01:00
{{/if}}