2019-10-27 21:16:25 +01:00
|
|
|
{{#let @form as |form|}}
|
2020-01-18 12:17:06 +01:00
|
|
|
{{#each @options as |option index|}}
|
2019-10-27 21:16:25 +01:00
|
|
|
<form.element
|
|
|
|
{{! show label only on first item }}
|
|
|
|
@label={{unless index (t "create.options.options.label")}}
|
|
|
|
@model={{option}}
|
|
|
|
@property="title"
|
|
|
|
class="option"
|
|
|
|
as |el|
|
|
|
|
>
|
|
|
|
<div class="input-group">
|
|
|
|
<el.control
|
|
|
|
@onChange={{action (mut el.value)}}
|
2019-10-29 08:42:00 +01:00
|
|
|
@value={{el.value}}
|
|
|
|
id={{el.id}}
|
2020-10-27 22:34:08 +01:00
|
|
|
|
|
|
|
{{! first control should be focused automatically }}
|
|
|
|
{{autofocus enabled=(eq index 0)}}
|
2019-10-27 21:16:25 +01:00
|
|
|
/>
|
|
|
|
<div class="input-group-append">
|
|
|
|
<BsButton
|
|
|
|
@onClick={{action "deleteOption" option}}
|
|
|
|
@type="link"
|
|
|
|
class="delete"
|
|
|
|
{{! disable delete button if there is only one option }}
|
2020-01-18 12:17:06 +01:00
|
|
|
disabled={{lte @options.length 1}}
|
2019-10-27 21:16:25 +01:00
|
|
|
>
|
|
|
|
<span class="oi oi-trash" title={{t "create.options.button.delete.label"}} aria-hidden="true"></span>
|
|
|
|
<span class="sr-only">{{t "create.options.button.delete.label"}}</span>
|
|
|
|
</BsButton>
|
|
|
|
</div>
|
2016-06-01 15:26:33 +02:00
|
|
|
</div>
|
2019-10-27 21:16:25 +01:00
|
|
|
|
|
|
|
<BsButton
|
2020-01-18 10:13:50 +01:00
|
|
|
@onClick={{fn this.addOption option}}
|
2019-10-27 21:16:25 +01:00
|
|
|
@type="link"
|
|
|
|
@size="sm"
|
|
|
|
class="add float-left"
|
|
|
|
>
|
|
|
|
<span class="oi oi-plus" title={{t "create.options.button.add.label"}} aria-hidden="true"></span>
|
|
|
|
<span class="sr-only">{{t "create.options.button.add.label"}}</span>
|
|
|
|
</BsButton>
|
|
|
|
</form.element>
|
|
|
|
{{/each}}
|
|
|
|
{{/let}}
|