55 lines
1.6 KiB
Handlebars
55 lines
1.6 KiB
Handlebars
{{#each options as |option index|}}
|
|
{{! show label only on first item }}
|
|
{{#form.element
|
|
classNames="option"
|
|
label=(unless index (t "create.options.options.label"))
|
|
model=option
|
|
property="title"
|
|
as |el|
|
|
}}
|
|
<div class="input-group">
|
|
{{bs-form/element/control/input
|
|
autofocus=(unless index true false)
|
|
id=el.id
|
|
value=el.value
|
|
onChange=(action (mut el.value))
|
|
}}
|
|
<div class="input-group-btn">
|
|
{{! disable delete button if there is only one option }}
|
|
{{#bs-button
|
|
onClick=(action "deleteOption" option)
|
|
type=(if
|
|
(eq el.validation "success")
|
|
"btn-success"
|
|
(if
|
|
(eq el.validation "error")
|
|
"btn-danger"
|
|
"btn-default"
|
|
)
|
|
)
|
|
disabled=(lte options.length 1)
|
|
class="delete"
|
|
}}
|
|
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
|
|
<span class="sr-only">{{t "create.options.button.delete.label"}}</span>
|
|
{{/bs-button}}
|
|
{{#bs-button
|
|
onClick=(action "addOption" option)
|
|
type=(if
|
|
(eq el.validation "success")
|
|
"btn-success"
|
|
(if
|
|
(eq el.validation "error")
|
|
"btn-danger"
|
|
"btn-default"
|
|
)
|
|
)
|
|
class="add"
|
|
}}
|
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
|
<span class="sr-only">{{t "create.options.button.add.label"}}</span>
|
|
{{/bs-button}}
|
|
</div>
|
|
</div>
|
|
{{/form.element}}
|
|
{{/each}}
|