ui/lib/shared/addon/components/new-select/template.hbs

38 lines
1.2 KiB
Handlebars

<select disabled={{or asyncContent.loading disabled}} onchange={{action "onChange"}}>
{{#if prompt}}
<option selected={{not selection}}>
{{#if localizedPrompt}}
{{t prompt}}
{{else}}
{{prompt}}
{{/if}}
</option>
{{/if}}
{{#each ungroupedContent as |item|}}
<option value="{{get item optionValuePath}}" selected={{eq value (get item optionValuePath)}} disabled={{get item optionDisabledPath}}>
{{#if localizedLabel}}
{{t (get item optionLabelPath)}}
{{else if localizedHtmlLabel}}
{{t (get item optionLabelPath) htmlSafe=true}}
{{else}}
{{get item optionLabelPath}}
{{/if}}
</option>
{{/each}}
{{#each groupedContent as |group|}}
<optgroup label="{{group.group}}">
{{#each group.options as |item|}}
<option value="{{get item optionValuePath}}" selected={{eq value (get item optionValuePath)}} disabled={{get item optionDisabledPath}}>
{{#if localizedLabel}}
{{t (get item optionLabelPath)}}
{{else}}
{{get item optionLabelPath}}
{{/if}}
</option>
{{/each}}
</optgroup>
{{/each}}
</select>
<i class="icon icon-spinner icon-spin" />