+ var width = $(hash.t).width();
+ width = width > 50 ? width : 50;
+ $('.header', hash.w).css({width: width});
+ hash.w.show();
+ },
+ onLoad: function(hash) {
+ $('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);
+ callback = ajaxable_callbacks[$trigger.attr('data-callback')];
+ callback && callback($trigger, response);
+ if (response.redirect)
+ window.location = response.redirect;
+ }
+ else {
+ $('.error', $window).remove();
+ $.each(response.errors, function(id, errors) {
+ $('#id_' + id, $window).before('<span class="error">' + errors[0] + '</span>');
+ });
+ $('input[type=submit]', $window).removeAttr('disabled');
+ return false;
+ }
+ }
+ });
+ }
+ });
+ });
+
+
+ var login_and_retry = function($form) {
+ var $window = $("#ajaxable-window").clone();
+ $window.attr("id", "context-login-window");
+ $('body').append($window);
+
+ $window.jqm({
+ ajax: '/uzytkownicy/zaloguj-utworz/',
+ ajaxText: '<p><img src="' + STATIC_URL + 'img/indicator.gif" alt="*"/> ' + gettext("Loading") + '</p>',
+ target: $('.target', $window)[0],
+ overlay: 60,
+ onShow: function(hash) {
+ var offset = $form.offset();
+ hash.w.css({position: 'absolute', left: offset.left - hash.w.width() + $form.width(), top: offset.top});
+ var width = $form.width();
+ width = width > 50 ? width : 50;
+ $('.header', hash.w).css({width: width});