Revision bcd2d642
Added by Benjamin Dauvergne almost 12 years ago
calebasse/static/js/calebasse.agenda.js | ||
---|---|---|
359 | 359 |
/* $('form', this).ajaxForm({ |
360 | 360 |
success: onsuccess |
361 | 361 |
}); */ |
362 |
var old_background_image, old_background_repeat, $button; |
|
362 | 363 |
$("#rdv").submit(function(event) { |
363 | 364 |
/* stop form from submitting normally */ |
364 | 365 |
event.preventDefault(); |
... | ... | |
367 | 368 |
$.post($form.attr('action'), $form.serialize(), |
368 | 369 |
function (data) { |
369 | 370 |
var parse = $(data); |
371 |
$button.css('background-image', old_background_image); |
|
372 |
$button.css('background-repeat', old_background_repeat); |
|
373 |
$button.removeAttr('disabled'); |
|
370 | 374 |
if ($('.errorlist', parse).length != 0) { |
371 | 375 |
$('#rdv').html(data); |
372 | 376 |
$('#rdv .datepicker-date').datepicker({dateFormat: 'd/m/yy', showOn: 'button'}); |
... | ... | |
377 | 381 |
}, |
378 | 382 |
"html"); |
379 | 383 |
}); |
384 |
var submit = function (ev) { |
|
385 |
$button = $(ev.target).parent(); |
|
386 |
old_background_image = $button.css('background-image'); |
|
387 |
old_background_repeat = $button.css('background-repeat'); |
|
388 |
$button.attr('disabled', 'disabled'); |
|
389 |
$button.css('background-image', 'url(/static/images/throbber.gif), ' + old_background_image); |
|
390 |
$button.css('background-repeat', 'no-repeat, ' + old_background_repeat); |
|
391 |
$("#rdv form").submit(); |
|
392 |
}; |
|
380 | 393 |
$(this).dialog({title: title, |
381 | 394 |
width: width, |
382 | 395 |
buttons: [ |
383 | 396 |
{ text: btn_text, |
384 |
click: function() { $("#rdv form").submit(); } }
|
|
397 |
click: submit }
|
|
385 | 398 |
]}); |
386 | 399 |
}); |
387 | 400 |
} |
Also available in: Unified diff
agenda: do not allow multiple submission of the new event dialog, fixes #2440