ui/lib/shared/addon/components/form-labels-annotations/template.hbs

100 lines
3.4 KiB
Handlebars

{{#accordion-list-item
title=(t "formLabelsAnnotations.title")
detail=(t detailKey appName=settings.appName)
showStatus=true
status=status
statusClass=statusClass
expandAll=expandAll
expand=(action expandFn)
}}
<div class="row">
{{#if editing}}
<div class="col span-6">
<div class="clearfix">
<label class="acc-label">{{t "formUserLabels.title"}}</label>
</div>
{{#if userLabelArray.length}}
<table class="table fixed no-lines js-label-table">
<thead>
<tr class="hidden-xs hidden-sm">
<th>{{t "formUserLabels.key.label"}}{{field-required}}</th>
<th width="30">&nbsp;</th>
<th>{{t "formUserLabels.value.label"}}</th>
<th width="40">&nbsp;</th>
</tr>
</thead>
<tbody>
{{#each userLabelArray as |label|}}
<tr>
<td data-title="key">
{{input-paste
pasted=(action "pastedLabels")
class="form-control input-sm key js-label"
type="text"
value=label.key
placeholder="formUserLabels.key.placeholder"
disabled=(eq label.readonly true)
}}
</td>
<td class="valign-top text-center">
{{#if editing}}
{{t "formKeyValue.separator"}}
{{/if}}
</td>
<td data-title="label">
{{input class="form-control input-sm" type="text" value=label.value placeholder=(t "formUserLabels.value.placeholder") disabled=(eq label.readonly true)}}
</td>
<td class="text-right">
<button class="btn bg-primary btn-sm" disabled={{eq label.readonly true}} type="button"
{{action "removeLabel" label}}><i class="icon icon-minus" /><span
class="sr-only">{{t "generic.remove"}}</span></button>
</td>
</tr>
{{/each}}
</tbody>
</table>
<div class="protip mb-5">
{{t "formUserLabels.protip"}}
</div>
{{/if}}
<button class="btn bg-link icon-btn" type="button" {{action "addUserLabel" }}>
<i class="icon icon-plus text-small" />
<span>{{t "formUserLabels.addAction"}}</span>
</button>
</div>
{{else}}
{{#if model.canHaveLabels}}
{{table-labels
header=(t "formUserLabels.title")
model=model.labels
}}
{{/if}}
{{/if}}
{{#unless editing}}
<hr class="mt-20 mb-20" />
{{/unless}}
<div class="col {{if editing " span-6" "span-12" }}">
{{#if editing}}
{{form-key-value
header=(t "formAnnotations.title")
editing=editing
readonlyArray=readonlyAnnotations
initialMap=model.annotations
changed=(action "annotationsChange")
addActionLabel="formAnnotations.addActionLabel"
}}
{{else}}
{{table-labels
header=(t "formAnnotations.title")
model=model.annotations
labelIntlSec="annotationsSection"
}}
{{/if}}
</div>
</div>
{{/accordion-list-item}}