Refactor "receive row" and "declare credit" tools per buefy theme

This commit is contained in:
Lance Edgar 2021-12-08 19:44:50 -06:00
parent ae76ceea04
commit 10e34b83ed
10 changed files with 313 additions and 89 deletions

View file

@ -1,4 +1,5 @@
## -*- coding: utf-8; -*-
<%namespace file="/forms/util.mako" import="render_buefy_field" />
<script type="text/x-template" id="${form.component}-template">
@ -9,6 +10,9 @@
% endif
<section>
% if form_body is not Undefined and form_body:
${form_body|n}
% else:
% for field in form.fields:
% if form.readonly or (field not in dform and field in form.readonly_fields):
<b-field horizontal
@ -17,29 +21,11 @@
</b-field>
% elif field in dform:
<% field = dform[field] %>
% if form.field_visible(field.name):
<b-field horizontal
label="${form.get_label(field.name)}"
## TODO: is this class="file" really needed?
% if isinstance(field.schema.typ, deform.FileData):
class="file"
% endif
% if field.error:
type="is-danger"
:message='${form.messages_json(field.error.messages())|n}'
% endif
>
${field.serialize(use_buefy=True)|n}
</b-field>
% else:
## hidden field
${field.serialize()|n}
% endif
${render_buefy_field(dform[field])}
% endif
% endfor
% endif
</section>
% if buttons:
@ -48,6 +34,20 @@
% elif not form.readonly and (buttons is Undefined or (buttons is not None and buttons is not False)):
<br />
<div class="buttons">
% if getattr(form, 'show_cancel', True):
% if form.auto_disable_cancel:
<once-button tag="a" href="${form.cancel_url or request.get_referrer()}"
text="Cancel">
</once-button>
% else:
<b-button tag="a" href="${form.cancel_url or request.get_referrer()}">
Cancel
</b-button>
% endif
% endif
% if getattr(form, 'show_reset', False):
<input type="reset" value="Reset" class="button" />
% endif
## TODO: deprecate / remove the latter option here
% if form.auto_disable_save or form.auto_disable:
<b-button type="is-primary"
@ -61,20 +61,6 @@
${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
% if getattr(form, 'show_cancel', True):
% if form.auto_disable_cancel:
<once-button tag="a" href="${form.cancel_url or request.get_referrer()}"
text="Cancel">
</once-button>
% else:
<b-button tag="a" href="${form.cancel_url or request.get_referrer()}">
Cancel
</b-button>
% endif
% endif
</div>
% endif