Assume forms support Buefy if theme does; fix basic CRUD views
This commit is contained in:
parent
7b1947914e
commit
b829cd260c
|
@ -70,6 +70,7 @@ header .level .theme-picker {
|
|||
******************************/
|
||||
|
||||
#context-menu {
|
||||
margin-bottom: 1em;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,32 @@
|
|||
|
||||
<%def name="context_menu_items()"></%def>
|
||||
|
||||
<%def name="object_helpers()"></%def>
|
||||
|
||||
<%def name="render_form_buttons()"></%def>
|
||||
|
||||
<%def name="render_form()">
|
||||
${form.render()|n}
|
||||
${form.render(buttons=capture(self.render_form_buttons))|n}
|
||||
</%def>
|
||||
|
||||
<%def name="render_form_complete()">
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
|
||||
<div class="form-wrapper">
|
||||
${self.render_form()}
|
||||
</div>
|
||||
|
||||
<div style="display: flex;">
|
||||
<div class="object-helpers">
|
||||
${self.object_helpers()}
|
||||
</div>
|
||||
|
||||
<ul id="context-menu">
|
||||
${self.context_menu_items()}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
<%def name="make_buefy_form_app()">
|
||||
|
@ -24,17 +48,7 @@
|
|||
</%def>
|
||||
|
||||
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
|
||||
<div class="form-wrapper">
|
||||
${self.render_form()}
|
||||
</div>
|
||||
|
||||
<ul id="context-menu">
|
||||
${self.context_menu_items()}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
${self.render_form_complete()}
|
||||
|
||||
% if form.use_buefy:
|
||||
${self.make_buefy_form_app()}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
|
||||
<script type="text/x-template" id="buefy-form-template">
|
||||
<div>
|
||||
% if not form.readonly:
|
||||
${h.form(form.action_url, id=dform.formid, method='post', enctype='multipart/form-data', **form_kwargs)}
|
||||
${h.csrf_token(request)}
|
||||
|
@ -54,6 +55,7 @@
|
|||
% if not form.readonly:
|
||||
${h.end_form()}
|
||||
% endif
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
|
||||
<div class="form">
|
||||
${form.render_deform()|n}
|
||||
${form.render_deform(buttons=buttons)|n}
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/base.mako" />
|
||||
<%inherit file="/form.mako" />
|
||||
|
||||
<%def name="title()">Delete ${model_title}: ${instance_title}</%def>
|
||||
|
||||
|
@ -12,39 +12,40 @@
|
|||
<li>${h.link_to("Edit this {}".format(model_title), action_url('edit', instance))}</li>
|
||||
% endif
|
||||
% if master.creatable and master.show_create_link and request.has_perm('{}.create'.format(permission_prefix)):
|
||||
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
|
||||
% if master.creates_multiple:
|
||||
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
|
||||
% else:
|
||||
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
|
||||
% endif
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="confirmation()">
|
||||
<%def name="render_form()">
|
||||
<br />
|
||||
<p>You are about to delete the following ${model_title} and all associated data:</p>
|
||||
|
||||
${parent.render_form()}
|
||||
</%def>
|
||||
|
||||
<%def name="render_form_buttons()">
|
||||
<br />
|
||||
<p>Are you sure about this?</p>
|
||||
<br />
|
||||
|
||||
${h.form(request.current_route_url(), class_='autodisable')}
|
||||
${h.form(request.current_route_url(), class_=None if form.use_buefy else 'autodisable')}
|
||||
${h.csrf_token(request)}
|
||||
<div class="buttons">
|
||||
<a class="button" href="${form.cancel_url}">Whoops, nevermind...</a>
|
||||
${h.submit('submit', "Yes, please DELETE this data forever!", class_='button is-primary')}
|
||||
% if form.use_buefy:
|
||||
<once-button type="is-primary" native-type="submit"
|
||||
text="Yes, please DELETE this data forever!">
|
||||
</once-button>
|
||||
% else:
|
||||
${h.submit('submit', "Yes, please DELETE this data forever!", class_='button is-primary')}
|
||||
% endif
|
||||
</div>
|
||||
${h.end_form()}
|
||||
</%def>
|
||||
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
|
||||
<div>
|
||||
<br />
|
||||
<p>You are about to delete the following ${model_title} and all associated data:</p>
|
||||
|
||||
<div class="form-wrapper">
|
||||
${form.render()|n}
|
||||
</div><!-- form-wrapper -->
|
||||
|
||||
${self.confirmation()}
|
||||
</div>
|
||||
|
||||
<ul id="context-menu">
|
||||
${self.context_menu_items()}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
${parent.body()}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/base.mako" />
|
||||
<%inherit file="/form.mako" />
|
||||
|
||||
<%def name="title()">Edit: ${instance_title}</%def>
|
||||
|
||||
|
@ -28,18 +28,13 @@
|
|||
<li>${h.link_to("Delete this {}".format(model_title), action_url('delete', instance))}</li>
|
||||
% endif
|
||||
% if master.creatable and master.show_create_link and request.has_perm('{}.create'.format(permission_prefix)):
|
||||
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
|
||||
% if master.creates_multiple:
|
||||
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
|
||||
% else:
|
||||
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
|
||||
% endif
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
|
||||
<div class="form-wrapper">
|
||||
${form.render()|n}
|
||||
</div><!-- form-wrapper -->
|
||||
|
||||
<ul id="context-menu">
|
||||
${self.context_menu_items()}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
${parent.body()}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/base.mako" />
|
||||
<%inherit file="/form.mako" />
|
||||
|
||||
<%def name="title()">${index_title} » ${instance_title}</%def>
|
||||
|
||||
|
@ -65,30 +65,12 @@
|
|||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="object_helpers()"></%def>
|
||||
|
||||
<%def name="render_row_grid_tools()">
|
||||
${rows_grid_tools}
|
||||
</%def>
|
||||
|
||||
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
|
||||
<div class="form-wrapper">
|
||||
${form.render()|n}
|
||||
</div><!-- form-wrapper -->
|
||||
|
||||
<div style="display: flex;">
|
||||
<div class="object-helpers">
|
||||
${self.object_helpers()}
|
||||
</div>
|
||||
|
||||
<ul id="context-menu">
|
||||
${self.context_menu_items()}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
${self.render_form_complete()}
|
||||
|
||||
% if master.has_rows:
|
||||
% if use_buefy:
|
||||
|
@ -100,3 +82,7 @@
|
|||
${rows_grid|n}
|
||||
% endif
|
||||
% endif
|
||||
|
||||
% if form.use_buefy:
|
||||
${self.make_buefy_form_app()}
|
||||
% endif
|
||||
|
|
|
@ -51,7 +51,6 @@ class EmailBouncesView(MasterView):
|
|||
url_prefix = '/email-bounces'
|
||||
creatable = False
|
||||
editable = False
|
||||
supports_buefy_forms = True
|
||||
|
||||
labels = {
|
||||
'config_key': "Source",
|
||||
|
|
|
@ -97,10 +97,6 @@ class MasterView(View):
|
|||
supports_prev_next = False
|
||||
supports_import_batch_from_file = False
|
||||
|
||||
# whether or not Buefy is supported for CRUD forms. we're turning this on,
|
||||
# "one view at a time" until it makes sense for that to be global default.
|
||||
supports_buefy_forms = False
|
||||
|
||||
# quickie (search)
|
||||
supports_quickie_search = False
|
||||
expose_quickie_search = False
|
||||
|
@ -2827,7 +2823,7 @@ class MasterView(View):
|
|||
'readonly': self.viewing,
|
||||
'model_class': getattr(self, 'model_class', None),
|
||||
'action_url': self.request.current_route_url(_query=None),
|
||||
'use_buefy': self.supports_buefy_forms and self.get_use_buefy(),
|
||||
'use_buefy': self.get_use_buefy(),
|
||||
}
|
||||
if self.creating:
|
||||
kwargs.setdefault('cancel_url', self.get_index_url())
|
||||
|
|
Loading…
Reference in a new issue