decide.nolog.cz/app/templates/create/settings.hbs
Jeldrik Hanschke 748b17e0ea
answers could be derived from answerType (#704)
* answers could be derived from answerType

* improve readability of API test data

* update API tests for removed answers property
2023-10-23 17:33:25 +02:00

82 lines
No EOL
2.3 KiB
Handlebars

<div class="cr-form-wrapper box">
<BsForm
@formLayout="horizontal"
@model={{this}}
@onInvalid={{(scroll-first-invalid-element-into-view-port)}}
@onSubmit={{this.submit}}
novalidate
as |form|
>
<form.element
@label={{t "create.settings.answerType.label"}}
@property="answerType"
@showValidationOn={{array "change" "focusOut"}}
@useIcons={{false}}
class="answer-type"
as |el|
>
<select
id={{el.id}}
class="custom-select"
{{on "change" (action el.setValue value="target.value")}}
{{autofocus}}
>
{{#each this.answerTypes as |answerType|}}
<option
value={{answerType.id}}
selected={{eq el.value answerType.id}}
>
{{t answerType.labelTranslation}}
</option>
{{/each}}
</select>
</form.element>
<form.element
@controlType="select"
@label={{t "create.settings.expirationDate.label"}}
@property="expirationDuration"
@showValidationOn={{array "change" "focusOut"}}
@useIcons={{false}}
class="expiration-duration"
as |el|
>
<select
id={{el.id}}
{{on "change" (pick "target.value" el.setValue)}}
class="custom-select"
>
{{#each this.expirationDurations as |duration|}}
<option value={{duration.id}} selected={{eq el.value duration.id}}>
{{t duration.labelTranslation}}
</option>
{{/each}}
</select>
</form.element>
<form.element
@controlType="checkbox"
@label={{t "create.settings.anonymousUser.label"}}
@showValidationOn="change"
@property="anonymousUser"
class="anonymous-user"
/>
<form.element
@controlType="checkbox"
@label={{t "create.settings.forceAnswer.label"}}
@showValidationOn="change"
@property="forceAnswer"
class="force-answer"
/>
<div class="row cr-steps-bottom-nav">
<div class="col-6 col-md-8 order-12">
<SaveButton
@isPending={{form.isSubmitting}}
data-test-button="submit"
/>
</div>
<div class="col-6 col-md-4 order-1 text-right">
<BackButton @onClick={{action "previousPage"}} />
</div>
</div>
</BsForm>
</div>