X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/eb59143b0d1b21cfcbe1b7067f027d768fa88fcc..d316a52151685a1b7c295baa12b73a73eabe5657:/wolnelektury/static/js/dialogs.js diff --git a/wolnelektury/static/js/dialogs.js b/wolnelektury/static/js/dialogs.js deleted file mode 100755 index bf9d94b54..000000000 --- a/wolnelektury/static/js/dialogs.js +++ /dev/null @@ -1,64 +0,0 @@ -(function($) { - $(function() { - - // create containers for all ajaxable form links - $('.ajaxable').each(function() { - var $window = $("#ajaxable-window").clone(); - $window.attr("id", this.id + "-window"); - $('body').append($window); - - var trigger = '#' + this.id; - - var href = $(this).attr('href'); - if (href.search('\\?') != -1) - href += '&ajax=1'; - else href += '?ajax=1'; - - $window.jqm({ - ajax: href, - ajaxText: '

* ' + gettext("Loading") + '

', - target: $('.target', $window)[0], - overlay: 60, - trigger: trigger, - onShow: function(hash) { - var offset = $(hash.t).offset(); - hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $(hash.t).width(), top: offset.top}); - $('.header', hash.w).css({width: $(hash.t).width()}); - hash.w.show(); - }, - onLoad: function(hash) { - $('form', hash.w).each(function() { - if (this.action.search('[\\?&]ajax=1') != -1) - return; - if (this.action.search('\\?') != -1) - this.action += '&ajax=1'; - else this.action += '?ajax=1'; - }); - $('form', hash.w).ajaxForm({ - dataType: 'json', - target: $('.target', $window), - success: function(response) { - if (response.success) { - $('.target', $window).text(response.message); - setTimeout(function() { $window.jqmHide() }, 1000); - if (response.redirect) - window.location = response.redirect; - } - else { - $('.error', $window).remove(); - $.each(response.errors, function(id, errors) { - $('#id_' + id, $window).before('' + errors[0] + ''); - }); - $('input[type=submit]', $window).removeAttr('disabled'); - return false; - } - } - }); - } - }); - }); - - - }); -})(jQuery) -