call qr.submit from cooldown

This commit is contained in:
James Campos 2011-07-20 02:51:25 -07:00
parent d313525c8c
commit 861e993fd0
2 changed files with 10 additions and 7 deletions

View File

@ -1209,7 +1209,7 @@
return cooldown.interval = window.setInterval(cooldown.cb, 1000); return cooldown.interval = window.setInterval(cooldown.cb, 1000);
}, },
cb: function() { cb: function() {
var submit, submits, _i, _j, _len, _len2, _ref, _results, _results2; var submit, submits, _i, _j, _len, _len2, _ref, _results;
cooldown.duration--; cooldown.duration--;
submits = $$('#com_submit'); submits = $$('#com_submit');
if (cooldown.duration) { if (cooldown.duration) {
@ -1221,14 +1221,14 @@
return _results; return _results;
} else { } else {
window.clearInterval(cooldown.interval); window.clearInterval(cooldown.interval);
_results2 = [];
for (_j = 0, _len2 = submits.length; _j < _len2; _j++) { for (_j = 0, _len2 = submits.length; _j < _len2; _j++) {
submit = submits[_j]; submit = submits[_j];
submit.disabled = false; submit.disabled = false;
submit.value = 'Submit'; submit.value = 'Submit';
_results2.push(((_ref = $('#auto')) != null ? _ref.checked : void 0) ? $('#qr_form').submit() : void 0);
} }
return _results2; if ((_ref = $('#auto')) != null ? _ref.checked : void 0) {
return qr.submit.call($('#qr_form'));
}
} }
} }
}; };
@ -1315,7 +1315,9 @@
isQR = this.id === 'qr_form'; isQR = this.id === 'qr_form';
inputfile = $('input[type=file]', this); inputfile = $('input[type=file]', this);
if (inputfile.value && inputfile.files[0].size > $('input[name=MAX_FILE_SIZE]').value) { if (inputfile.value && inputfile.files[0].size > $('input[name=MAX_FILE_SIZE]').value) {
e.preventDefault(); if (e) {
e.preventDefault();
}
if (isQR) { if (isQR) {
return $('#error').textContent = 'Error: File too large.'; return $('#error').textContent = 'Error: File too large.';
} else { } else {

View File

@ -960,7 +960,8 @@ cooldown =
for submit in submits for submit in submits
submit.disabled = false submit.disabled = false
submit.value = 'Submit' submit.value = 'Submit'
$('#qr_form').submit() if $('#auto')?.checked if $('#auto')?.checked
qr.submit.call $ '#qr_form'
qr = qr =
init: -> init: ->
@ -1032,7 +1033,7 @@ qr =
inputfile = $('input[type=file]', @) inputfile = $('input[type=file]', @)
if inputfile.value and inputfile.files[0].size > $('input[name=MAX_FILE_SIZE]').value if inputfile.value and inputfile.files[0].size > $('input[name=MAX_FILE_SIZE]').value
e.preventDefault() e.preventDefault() if e
if isQR if isQR
$('#error').textContent = 'Error: File too large.' $('#error').textContent = 'Error: File too large.'
else else