Use <once-button>
where applicable for CRUD forms
This commit is contained in:
parent
5907973d42
commit
6be4964221
|
@ -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>
|
||||
|
|
|
@ -88,6 +88,7 @@ class ProfilesView(MasterView):
|
|||
pass
|
||||
|
||||
def make_printer_settings_form(self, profile, printer):
|
||||
use_buefy = self.get_use_buefy()
|
||||
schema = colander.Schema()
|
||||
|
||||
for name, label in printer.required_settings.items():
|
||||
|
@ -98,11 +99,13 @@ class ProfilesView(MasterView):
|
|||
schema.add(node)
|
||||
|
||||
form = forms.Form(schema=schema, request=self.request,
|
||||
use_buefy=use_buefy,
|
||||
model_instance=profile,
|
||||
# TODO: ugh, this is necessary to avoid some logic
|
||||
# which assumes a ColanderAlchemy schema i think?
|
||||
appstruct=None)
|
||||
form.cancel_url = self.get_action_url('view', profile)
|
||||
form.auto_disable_cancel = True
|
||||
|
||||
form.insert_before(schema.children[0].name, 'label_profile')
|
||||
form.set_readonly('label_profile')
|
||||
|
|
Loading…
Reference in a new issue