ui/lib/shared/addon/components/form-key-value/template.hbs

78 lines
2.5 KiB
Handlebars

<div class="clearfix">
{{#if header}}
<label class="acc-label">{{header}}</label>
{{/if}}
</div>
{{#if ary.length}}
<table class="table fixed no-lines small mb-10">
<thead>
<tr class="hidden-sm">
<th>{{t keyLabel}}{{#if (and editing allowEditKey)}}{{field-required}}{{/if}}</th>
<th width="30">&nbsp;</th>
<th>{{t valueLabel}}</th>
<th width="10">&nbsp;</th>
<th width="30">&nbsp;</th>
</tr>
</thead>
<tbody>
{{#each ary as |row|}}
<tr>
<td data-title="{{t keyLabel}}:">
{{#if (and editing allowEditKey (not-eq row.editable false))}}
{{input-paste pasted="pastedValues" class="form-control input-sm key" type="text" value=row.key placeholder=keyPlaceholder}}
{{else}}
{{row.key}}
{{/if}}
</td>
<td class="valign-top text-center">
{{#if editing}}
{{t 'formKeyValue.separator'}}
{{/if}}
</td>
<td data-title="{{t valueLabel}}:">
{{#if editing}}
{{#if allowMultilineValue}}
{{textarea-autogrow class=(concat "form-control input-sm value" (if concealValue " conceal")) spellcheck="false" required=true value=row.value placeholder=valuePlaceholder disabled=(eq row.editable false)}}
{{else}}
{{input class=(concat "form-control input-sm value" (if concealValue " conceal")) spellcheck="false" type="text" value=row.value placeholder=valuePlaceholder disabled=(eq row.editable false)}}
{{/if}}
{{else}}
<span class="{{if concealValue 'conceal'}}">{{row.value}}</span>
{{/if}}
</td>
<td>&nbsp;</td>
<td class="valign-top text-right">
{{#if (and editing allowRemove)}}
<button class="btn bg-primary btn-sm" {{action "remove" row}}><i class="icon icon-minus"/><span class="sr-only">{{t 'generic.remove'}}</span></button>
{{/if}}
</td>
</tr>
{{#unless editing}}
<div class="pb-10"></div>
{{/unless}}
{{/each}}
</tbody>
</table>
{{else}}
{{#unless editing}}
<div>{{t 'generic.none'}}</div>
{{/unless}}
{{/if}}
{{#if (and editing allowAdd)}}
<div>
<button class="btn bg-link icon-btn p-0" {{action "add"}}>
<span class="darken"><i class="icon icon-plus text-small"/></span>
<span>{{t addActionLabel}}</span>
</button>
{{#if ary.length}}
<span class="protip pl-20">
{{t 'formKeyValue.protip'}}
</span>
{{/if}}
</div>
{{/if}}