lemo-crm/web/app/templates/components/form-input-select2.hbs
2020-11-08 14:34:10 +08:00

28 lines
1.3 KiB
Handlebars

<label class="{{get this 'label-class'}} control-label no-padding-right">{{label}}</label>
<div class="{{get this 'input-class'}} no-padding-right">
<div class="row col-xs-12 no-padding">
<div class="col-xs-{{col-width}} no-padding-right">
<select multiple={{multiple}}
data-placeholder={{if placeholder placeholder label}}
class="select2"
style="width: 100%;">
{{#each options as |option|}}
<option value={{get option (get this 'value-field')}} selected={{if option.selected 'selected'}}>
{{!text-exp: $text($value)}}
{{#if (get option (get this 'value-field'))}}
{{option-text-exp option (get this 'value-field') (get this 'text-field') (get this 'text-exp')}}
{{/if}}
</option>
{{/each}}
</select>
{{#each options as |option|}}
{{#if option.selected}}
<input type="hidden" name="{{name}}" value="{{get option (get this 'value-field')}}" />
{{/if}}
{{/each}}
</div>
</div>
</div>
{{#if (get this 'error-msg')}}
{{form-input-errors-msg name=name}}
{{/if}}