Fix auto-disable button on form submit, per Chrome issues
dang it chrome, why you gotta be like that
This commit is contained in:
parent
178b9f2bcb
commit
e945ebe325
|
@ -177,8 +177,14 @@ $(function() {
|
|||
$('a.button.autodisable').click(function() {
|
||||
disable_button(this);
|
||||
});
|
||||
$('input[type="submit"].autodisable').click(function() {
|
||||
disable_button(this);
|
||||
// for some reason chrome requires us to do things this way...
|
||||
// https://stackoverflow.com/questions/16867080/onclick-javascript-stops-form-submit-in-chrome
|
||||
// https://stackoverflow.com/questions/5691054/disable-submit-button-on-form-submit
|
||||
$('form.autodisable').submit(function() {
|
||||
var submit = $(this).find('input[type="submit"]');
|
||||
if (submit.length) {
|
||||
disable_button(submit);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
|
|
|
@ -138,7 +138,7 @@
|
|||
var logout_url = '${request.route_url('logout')}';
|
||||
var noop_url = '${request.route_url('noop')}';
|
||||
</script>
|
||||
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.js'))}
|
||||
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.js') + '?ver={}'.format(tailbone.__version__))}
|
||||
</%def>
|
||||
|
||||
<%def name="extra_javascript()"></%def>
|
||||
|
|
|
@ -14,11 +14,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)}
|
||||
${h.hidden('clone', value='clone')}
|
||||
<div class="buttons">
|
||||
${h.link_to("Whoops, nevermind...", form.cancel_url, class_='button autodisable')}
|
||||
${h.submit('submit', "Yes, please clone away", class_='autodisable')}
|
||||
${h.submit('submit', "Yes, please clone away")}
|
||||
</div>
|
||||
${h.end_form()}
|
||||
|
|
|
@ -41,9 +41,9 @@ ${parent.body()}
|
|||
% if not instance.executed and request.has_perm('{}.execute'.format(permission_prefix)):
|
||||
<div class="buttons">
|
||||
% if instance.enabled and not instance.executing:
|
||||
${h.form(url('{}.execute'.format(route_prefix), uuid=instance.uuid))}
|
||||
${h.form(url('{}.execute'.format(route_prefix), uuid=instance.uuid), class_='autodisable')}
|
||||
${h.csrf_token(request)}
|
||||
${h.submit('execute', "Execute this upgrade", class_='autodisable')}
|
||||
${h.submit('execute', "Execute this upgrade")}
|
||||
${h.end_form()}
|
||||
% elif instance.enabled:
|
||||
<button type="button" disabled="disabled" title="This upgrade is currently executing">Execute this upgrade</button>
|
||||
|
|
Loading…
Reference in a new issue