Fix "delete object" form submit

not real sure why that broke, but this is a better pattern anyway
This commit is contained in:
Lance Edgar 2018-11-28 15:37:35 -06:00
parent 508359a939
commit c56eadc49b

View file

@ -1,22 +1,8 @@
## -*- coding: utf-8 -*-
## -*- coding: utf-8; -*-
<%inherit file="/base.mako" />
<%def name="title()">Delete ${model_title}: ${instance_title}</%def>
<%def name="head_tags()">
${parent.head_tags()}
<script type="text/javascript">
$(function() {
$('#confirm-delete').click(function() {
$(this).button('disable').button('option', 'label', "Deleting, please wait...");
$(this).parents('form').submit();
});
});
</script>
</%def>
<%def name="context_menu_items()">
<li>${h.link_to("Back to {}".format(model_title_plural), url(route_prefix))}</li>
% if master.viewable and request.has_perm('{}.view'.format(permission_prefix)):
@ -35,11 +21,11 @@
<p>Are you sure about this?</p>
<br />
${h.form(request.current_route_url())}
${h.form(request.current_route_url(), class_='autodisable')}
${h.csrf_token(request)}
<div class="buttons">
<a class="button" href="${form.cancel_url}">Whoops, nevermind...</a>
<button type="button" id="confirm-delete">Yes, please DELETE this data forever!</button>
${h.submit('submit', "Yes, please DELETE this data forever!")}
</div>
${h.end_form()}
</%def>