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 {
|
#context-menu {
|
||||||
|
margin-bottom: 1em;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,32 @@
|
||||||
|
|
||||||
<%def name="context_menu_items()"></%def>
|
<%def name="context_menu_items()"></%def>
|
||||||
|
|
||||||
|
<%def name="object_helpers()"></%def>
|
||||||
|
|
||||||
|
<%def name="render_form_buttons()"></%def>
|
||||||
|
|
||||||
<%def name="render_form()">
|
<%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>
|
||||||
|
|
||||||
<%def name="make_buefy_form_app()">
|
<%def name="make_buefy_form_app()">
|
||||||
|
@ -24,17 +48,7 @@
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
||||||
<div style="display: flex; justify-content: space-between;">
|
${self.render_form_complete()}
|
||||||
|
|
||||||
<div class="form-wrapper">
|
|
||||||
${self.render_form()}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul id="context-menu">
|
|
||||||
${self.context_menu_items()}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
% if form.use_buefy:
|
% if form.use_buefy:
|
||||||
${self.make_buefy_form_app()}
|
${self.make_buefy_form_app()}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
## -*- coding: utf-8; -*-
|
## -*- coding: utf-8; -*-
|
||||||
|
|
||||||
<script type="text/x-template" id="buefy-form-template">
|
<script type="text/x-template" id="buefy-form-template">
|
||||||
|
<div>
|
||||||
% if not form.readonly:
|
% if not form.readonly:
|
||||||
${h.form(form.action_url, id=dform.formid, method='post', enctype='multipart/form-data', **form_kwargs)}
|
${h.form(form.action_url, id=dform.formid, method='post', enctype='multipart/form-data', **form_kwargs)}
|
||||||
${h.csrf_token(request)}
|
${h.csrf_token(request)}
|
||||||
|
@ -54,6 +55,7 @@
|
||||||
% if not form.readonly:
|
% if not form.readonly:
|
||||||
${h.end_form()}
|
${h.end_form()}
|
||||||
% endif
|
% endif
|
||||||
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
## -*- coding: utf-8; -*-
|
## -*- coding: utf-8; -*-
|
||||||
|
|
||||||
<div class="form">
|
<div class="form">
|
||||||
${form.render_deform()|n}
|
${form.render_deform(buttons=buttons)|n}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
## -*- coding: utf-8; -*-
|
## -*- coding: utf-8; -*-
|
||||||
<%inherit file="/base.mako" />
|
<%inherit file="/form.mako" />
|
||||||
|
|
||||||
<%def name="title()">Delete ${model_title}: ${instance_title}</%def>
|
<%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>
|
<li>${h.link_to("Edit this {}".format(model_title), action_url('edit', instance))}</li>
|
||||||
% endif
|
% endif
|
||||||
% if master.creatable and master.show_create_link and request.has_perm('{}.create'.format(permission_prefix)):
|
% if master.creatable and master.show_create_link and request.has_perm('{}.create'.format(permission_prefix)):
|
||||||
|
% 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>
|
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
|
||||||
% endif
|
% endif
|
||||||
|
% endif
|
||||||
</%def>
|
</%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 />
|
<br />
|
||||||
<p>Are you sure about this?</p>
|
<p>Are you sure about this?</p>
|
||||||
<br />
|
<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)}
|
${h.csrf_token(request)}
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<a class="button" href="${form.cancel_url}">Whoops, nevermind...</a>
|
<a class="button" href="${form.cancel_url}">Whoops, nevermind...</a>
|
||||||
|
% 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')}
|
${h.submit('submit', "Yes, please DELETE this data forever!", class_='button is-primary')}
|
||||||
|
% endif
|
||||||
</div>
|
</div>
|
||||||
${h.end_form()}
|
${h.end_form()}
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<div style="display: flex; justify-content: space-between;">
|
|
||||||
|
|
||||||
<div>
|
${parent.body()}
|
||||||
<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>
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
## -*- coding: utf-8; -*-
|
## -*- coding: utf-8; -*-
|
||||||
<%inherit file="/base.mako" />
|
<%inherit file="/form.mako" />
|
||||||
|
|
||||||
<%def name="title()">Edit: ${instance_title}</%def>
|
<%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>
|
<li>${h.link_to("Delete this {}".format(model_title), action_url('delete', instance))}</li>
|
||||||
% endif
|
% endif
|
||||||
% if master.creatable and master.show_create_link and request.has_perm('{}.create'.format(permission_prefix)):
|
% if master.creatable and master.show_create_link and request.has_perm('{}.create'.format(permission_prefix)):
|
||||||
|
% 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>
|
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
|
||||||
% endif
|
% endif
|
||||||
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<div style="display: flex; justify-content: space-between;">
|
|
||||||
|
|
||||||
<div class="form-wrapper">
|
${parent.body()}
|
||||||
${form.render()|n}
|
|
||||||
</div><!-- form-wrapper -->
|
|
||||||
|
|
||||||
<ul id="context-menu">
|
|
||||||
${self.context_menu_items()}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
## -*- coding: utf-8; -*-
|
## -*- coding: utf-8; -*-
|
||||||
<%inherit file="/base.mako" />
|
<%inherit file="/form.mako" />
|
||||||
|
|
||||||
<%def name="title()">${index_title} » ${instance_title}</%def>
|
<%def name="title()">${index_title} » ${instance_title}</%def>
|
||||||
|
|
||||||
|
@ -65,30 +65,12 @@
|
||||||
% endif
|
% endif
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="object_helpers()"></%def>
|
|
||||||
|
|
||||||
<%def name="render_row_grid_tools()">
|
<%def name="render_row_grid_tools()">
|
||||||
${rows_grid_tools}
|
${rows_grid_tools}
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
||||||
<div style="display: flex; justify-content: space-between;">
|
${self.render_form_complete()}
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
% if master.has_rows:
|
% if master.has_rows:
|
||||||
% if use_buefy:
|
% if use_buefy:
|
||||||
|
@ -100,3 +82,7 @@
|
||||||
${rows_grid|n}
|
${rows_grid|n}
|
||||||
% endif
|
% endif
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
|
% if form.use_buefy:
|
||||||
|
${self.make_buefy_form_app()}
|
||||||
|
% endif
|
||||||
|
|
|
@ -51,7 +51,6 @@ class EmailBouncesView(MasterView):
|
||||||
url_prefix = '/email-bounces'
|
url_prefix = '/email-bounces'
|
||||||
creatable = False
|
creatable = False
|
||||||
editable = False
|
editable = False
|
||||||
supports_buefy_forms = True
|
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
'config_key': "Source",
|
'config_key': "Source",
|
||||||
|
|
|
@ -97,10 +97,6 @@ class MasterView(View):
|
||||||
supports_prev_next = False
|
supports_prev_next = False
|
||||||
supports_import_batch_from_file = 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)
|
# quickie (search)
|
||||||
supports_quickie_search = False
|
supports_quickie_search = False
|
||||||
expose_quickie_search = False
|
expose_quickie_search = False
|
||||||
|
@ -2827,7 +2823,7 @@ class MasterView(View):
|
||||||
'readonly': self.viewing,
|
'readonly': self.viewing,
|
||||||
'model_class': getattr(self, 'model_class', None),
|
'model_class': getattr(self, 'model_class', None),
|
||||||
'action_url': self.request.current_route_url(_query=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:
|
if self.creating:
|
||||||
kwargs.setdefault('cancel_url', self.get_index_url())
|
kwargs.setdefault('cancel_url', self.get_index_url())
|
||||||
|
|
Loading…
Reference in a new issue