tailbone/tailbone/templates/master/form.mako
Lance Edgar 1bb0330ab5 Refactory Buefy templates to use WholePage and ThisPage components
plus add `GridFilter.set_choices()` method
2019-08-03 16:57:13 -05:00

46 lines
1.5 KiB
Mako

## -*- coding: utf-8; -*-
<%inherit file="/form.mako" />
<%def name="context_menu_item_delete()">
% if master.deletable and instance_deletable and request.has_perm('{}.delete'.format(permission_prefix)):
% if master.delete_confirm == 'simple':
<li>
## note, the `ref` here is for buefy only
${h.form(action_url('delete', instance), ref='deleteObjectForm')}
${h.csrf_token(request)}
<a href="${action_url('delete', instance)}"
% if use_buefy:
@click.prevent="deleteObject"
% else:
class="delete-instance"
% endif
>
Delete this ${model_title}
</a>
${h.end_form()}
</li>
% else:
## assuming here that: delete_confirm == 'full'
<li>${h.link_to("Delete this {}".format(model_title), action_url('delete', instance))}</li>
% endif
% endif
</%def>
<%def name="modify_this_page_vars()">
${parent.modify_this_page_vars()}
% if master.deletable and instance_deletable and request.has_perm('{}.delete'.format(permission_prefix)) and master.delete_confirm == 'simple':
<script type="text/javascript">
ThisPage.methods.deleteObject = function() {
if (confirm("Are you sure you wish to delete this ${model_title}?")) {
this.$refs.deleteObjectForm.submit()
}
}
</script>
% endif
</%def>
${parent.body()}