Use <once-button> where applicable for CRUD forms

This commit is contained in:
Lance Edgar 2019-05-23 18:13:19 -05:00
parent 5907973d42
commit 6be4964221
2 changed files with 24 additions and 2 deletions

View file

@ -42,7 +42,18 @@
% elif not form.readonly and (buttons is Undefined or (buttons is not None and buttons is not False)):
<br />
<div class="buttons">
${h.submit('save', getattr(form, 'submit_label', getattr(form, 'save_label', "Submit")), class_='button is-primary')}
## TODO: deprecate / remove the latter option here
% if form.auto_disable_save or form.auto_disable:
<once-button type="is-primary"
native-type="submit"
text="${getattr(form, 'submit_label', getattr(form, 'save_label', "Submit"))}">
</once-button>
% else:
<b-button type="is-primary"
native-type="submit">
${getattr(form, 'submit_label', getattr(form, 'save_label', "Submit"))}
</b-button>
% endif
% if getattr(form, 'show_reset', False):
<input type="reset" value="Reset" class="button" />
% endif
@ -50,7 +61,15 @@
% if form.mobile:
${h.link_to("Cancel", form.cancel_url, class_='ui-btn ui-corner-all')}
% else:
${h.link_to("Cancel", form.cancel_url, class_='cancel button{}'.format(' autodisable' if form.auto_disable_cancel else ''))}
% if form.auto_disable_cancel:
<once-button tag="a" href="${form.cancel_url}"
text="Cancel">
</once-button>
% else:
<b-button tag="a" href="${form.cancel_url}">
Cancel
</b-button>
% endif
% endif
% endif
</div>