|
72 | 72 | if (token) xhr.setRequestHeader('X-CSRF-Token', token); |
73 | 73 | }, |
74 | 74 |
|
75 | | - // making sure that all forms have actual up-to-date token(cached forms contain old one) |
| 75 | + // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones) |
76 | 76 | refreshCSRFTokens: function(){ |
77 | 77 | $('form input[name="' + rails.csrfParam() + '"]').val(rails.csrfToken()); |
78 | 78 | }, |
|
334 | 334 | return false; |
335 | 335 | }, |
336 | 336 |
|
337 | | - // replace element's html with the 'data-disable-with' after storing original html |
| 337 | + // Replace element's html with the 'data-disable-with' after storing original html |
338 | 338 | // and prevent clicking on it |
339 | 339 | disableElement: function(element) { |
340 | 340 | var replacement = element.data('disable-with'); |
|
349 | 349 | }); |
350 | 350 | }, |
351 | 351 |
|
352 | | - // restore element to its original state which was disabled by 'disableElement' above |
| 352 | + // Restore element to its original state which was disabled by 'disableElement' above |
353 | 353 | enableElement: function(element) { |
354 | 354 | if (element.data('ujs:enable-with') !== undefined) { |
355 | 355 | element.html(element.data('ujs:enable-with')); // set to old enabled state |
|
404 | 404 | if (metaClick && (!method || method === 'GET') && !data) { return true; } |
405 | 405 |
|
406 | 406 | var handleRemote = rails.handleRemote(link); |
407 | | - // response from rails.handleRemote() will either be false or a deferred object promise. |
| 407 | + // Response from rails.handleRemote() will either be false or a deferred object promise. |
408 | 408 | if (handleRemote === false) { |
409 | 409 | rails.enableElement(link); |
410 | 410 | } else { |
|
426 | 426 | if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button); |
427 | 427 |
|
428 | 428 | var handleRemote = rails.handleRemote(button); |
429 | | - // response from rails.handleRemote() will either be false or a deferred object promise. |
| 429 | + // Response from rails.handleRemote() will either be false or a deferred object promise. |
430 | 430 | if (handleRemote === false) { |
431 | 431 | rails.enableFormElement(button); |
432 | 432 | } else { |
|
451 | 451 |
|
452 | 452 | if (!rails.allowAction(form)) return rails.stopEverything(e); |
453 | 453 |
|
454 | | - // skip other logic when required values are missing or file upload is present |
| 454 | + // Skip other logic when required values are missing or file upload is present |
455 | 455 | if (form.attr('novalidate') === undefined) { |
456 | 456 | blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false); |
457 | 457 | if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) { |
|
462 | 462 | if (remote) { |
463 | 463 | nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector); |
464 | 464 | if (nonBlankFileInputs) { |
465 | | - // slight timeout so that the submit button gets properly serialized |
| 465 | + // Slight timeout so that the submit button gets properly serialized |
466 | 466 | // (make it easy for event handler to serialize form without disabled values) |
467 | 467 | setTimeout(function(){ rails.disableFormElements(form); }, 13); |
468 | 468 | var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]); |
469 | 469 |
|
470 | | - // re-enable form elements if event bindings return false (canceling normal form submission) |
| 470 | + // Re-enable form elements if event bindings return false (canceling normal form submission) |
471 | 471 | if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); } |
472 | 472 |
|
473 | 473 | return aborted; |
|
477 | 477 | return false; |
478 | 478 |
|
479 | 479 | } else { |
480 | | - // slight timeout so that the submit button gets properly serialized |
| 480 | + // Slight timeout so that the submit button gets properly serialized |
481 | 481 | setTimeout(function(){ rails.disableFormElements(form); }, 13); |
482 | 482 | } |
483 | 483 | }); |
|
487 | 487 |
|
488 | 488 | if (!rails.allowAction(button)) return rails.stopEverything(event); |
489 | 489 |
|
490 | | - // register the pressed submit button |
| 490 | + // Register the pressed submit button |
491 | 491 | var name = button.attr('name'), |
492 | 492 | data = name ? {name:name, value:button.val()} : null; |
493 | 493 |
|
|
0 commit comments