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() {
|
$('a.button.autodisable').click(function() {
|
||||||
disable_button(this);
|
disable_button(this);
|
||||||
});
|
});
|
||||||
$('input[type="submit"].autodisable').click(function() {
|
// for some reason chrome requires us to do things this way...
|
||||||
disable_button(this);
|
// 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 logout_url = '${request.route_url('logout')}';
|
||||||
var noop_url = '${request.route_url('noop')}';
|
var noop_url = '${request.route_url('noop')}';
|
||||||
</script>
|
</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>
|
||||||
|
|
||||||
<%def name="extra_javascript()"></%def>
|
<%def name="extra_javascript()"></%def>
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
<p>Are you sure about this?</p>
|
<p>Are you sure about this?</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
${h.form(request.current_route_url())}
|
${h.form(request.current_route_url(), class_='autodisable')}
|
||||||
${h.csrf_token(request)}
|
${h.csrf_token(request)}
|
||||||
${h.hidden('clone', value='clone')}
|
${h.hidden('clone', value='clone')}
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
${h.link_to("Whoops, nevermind...", form.cancel_url, class_='button autodisable')}
|
${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>
|
</div>
|
||||||
${h.end_form()}
|
${h.end_form()}
|
||||||
|
|
|
@ -41,9 +41,9 @@ ${parent.body()}
|
||||||
% if not instance.executed and request.has_perm('{}.execute'.format(permission_prefix)):
|
% if not instance.executed and request.has_perm('{}.execute'.format(permission_prefix)):
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
% if instance.enabled and not instance.executing:
|
% 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.csrf_token(request)}
|
||||||
${h.submit('execute', "Execute this upgrade", class_='autodisable')}
|
${h.submit('execute', "Execute this upgrade")}
|
||||||
${h.end_form()}
|
${h.end_form()}
|
||||||
% elif instance.enabled:
|
% elif instance.enabled:
|
||||||
<button type="button" disabled="disabled" title="This upgrade is currently executing">Execute this upgrade</button>
|
<button type="button" disabled="disabled" title="This upgrade is currently executing">Execute this upgrade</button>
|
||||||
|
|
Loading…
Reference in a new issue