Sha256: 5b67b01da0f4557fd2317c71850fdcfbbed28316a09be68b356c5d1e2da93d35
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
$(document) .delegate('#new-comment-link, #new-comment-attachment-link', 'ajax:success', function(e, data, status, xhr){ var $this = $(this), $container = $('#new-comment-links'), $responseText = $(xhr.responseText), $cancelButton = $responseText.find('#cancel-button'); $container.replaceWith($responseText) $cancelButton.click(function(e){ $cancelButton.parent().replaceWith($container); e.preventDefault(); }); }) .delegate('form[data-remote]', 'ajax:aborted:required', function(){ var $form = $(this), errorDivId = 'ajax-validation-errors', $errorDiv = $form.find('#' + errorDivId); if ( ! $errorDiv.length ) { $errorDiv = $('<div>', { id: errorDivId}); $form.prepend($errorDiv) } $errorDiv.html($('<h2>', { text: 'You must fill in all required fields!' })); }) .delegate('form[data-remote]', 'ajax:error', function(e, xhr, status, statusText) { $('#comments').after('Error status code: ' + xhr.status + ', Error status message: ' + statusText); });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
remotipart-1.4.4 | spec/dummy_app/app/assets/javascripts/comments.js |
remotipart-1.4.3 | spec/dummy_app/app/assets/javascripts/comments.js |