open-vault/ui/app/templates/components/form-field-groups.hbs
2018-04-03 09:16:57 -05:00

30 lines
1,013 B
Handlebars

{{#each model.fieldGroups as |fieldGroup|}}
{{#each-in fieldGroup as |group fields|}}
{{#if (or (not renderGroup) (and renderGroup (eq group renderGroup)))}}
{{#if (eq group "default")}}
{{#each fields as |attr|}}
{{#unless (and (not-eq mode 'create') (eq attr.name "name"))}}
{{form-field data-test-field attr=attr model=model onChange=onChange}}
{{/unless}}
{{/each}}
{{else}}
{{toggle-button
class="is-block"
toggleAttr=(concat "show" (camelize group))
toggleTarget=this
openLabel=(concat "Hide " group)
closedLabel=group
data-test-toggle-group=group
}}
{{#if (get this (concat "show" (camelize group)))}}
<div class="box is-marginless">
{{#each fields as |attr|}}
{{form-field data-test-field attr=attr model=model}}
{{/each}}
</div>
{{/if}}
{{/if}}
{{/if}}
{{/each-in}}
{{/each}}