77afc0d9fa
This refactors references to values in templates from `{{foo}}` to either `{{this.foo}}` if it's a property of backing JavaScript class or `{{@foo}}` if it's passed in on invocation. You could find more details on this change in Ember docs: - [required `this` in templates](https://guides.emberjs.com/release/upgrading/current-edition/templates/#toc_required-this-in-templates) - [named arguments](https://guides.emberjs.com/release/upgrading/current-edition/templates/#toc_named-arguments) While doing this I noticed that `<PollEvaluationSummaryOption>` component could be easily refactored to a template-only component. Done it as part of this pull request even so it's technically not related.
44 lines
No EOL
1.4 KiB
Handlebars
44 lines
No EOL
1.4 KiB
Handlebars
{{#let @form as |form|}}
|
|
{{#each @options as |option index|}}
|
|
<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
|
|
{{! first control should be autofocused }}
|
|
@autofocus={{unless index true false}}
|
|
@onChange={{action (mut el.value)}}
|
|
@value={{el.value}}
|
|
id={{el.id}}
|
|
/>
|
|
<div class="input-group-append">
|
|
<BsButton
|
|
@onClick={{action "deleteOption" option}}
|
|
@type="link"
|
|
class="delete"
|
|
{{! disable delete button if there is only one option }}
|
|
disabled={{lte @options.length 1}}
|
|
>
|
|
<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>
|
|
</div>
|
|
|
|
<BsButton
|
|
@onClick={{fn this.addOption option}}
|
|
@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}} |