open-vault/ui/app/templates/components/edit-form.hbs

30 lines
1 KiB
Handlebars
Raw Normal View History

<form {{action (perform save model) on="submit"}}>
<MessageError @model={{model}} data-test-edit-form-error />
<div class="box is-sideless is-fullwidth is-marginless">
{{#each model.fields as |attr|}}
{{form-field data-test-field attr=attr model=model}}
{{/each}}
</div>
<div class="field is-grouped is-grouped-split is-fullwidth box is-bottomless">
<div class="field is-grouped">
<div class="control">
<button type="submit" data-test-edit-form-submit class="button is-primary {{if save.isRunning 'loading'}}" disabled={{save.isRunning}}>
Save
</button>
</div>
</div>
{{#if model.canDelete}}
<ConfirmAction
@buttonClasses="button is-ghost"
@onConfirmAction={{action (perform save model (hash method="destroyRecord"))}}
@confirmMessage="Are you sure you want to delete this config?"
data-test-edit-delete
>
<span data-test-edit-delete-text>
{{deleteButtonText}}
</span>
</ConfirmAction>
{{/if}}
</div>
</form>