diff options
Diffstat (limited to 'lib/gallery.dialog.js')
-rw-r--r-- | lib/gallery.dialog.js | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index 175f2a42..a3da41e3 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -17,7 +17,6 @@ function handleDialogEvent(event) { * @requires ui.dialog * @see handleDialogEvent() * - * @todo Set ui-dialog-buttonpane button values equal to the original form button value * @todo Display loading animation on form submit */ function openDialog(element, on_success) { @@ -28,7 +27,7 @@ function openDialog(element, on_success) { $("body").append(eDialog); $("#gDialog").dialog({ autoOpen: false, - autoResize: false, + autoResize: true, draggable: true, height: "auto", width: "auto", @@ -42,10 +41,10 @@ function openDialog(element, on_success) { $("#gDialog").dialog("destroy").remove(); } }); - loading("#gDialog"); + showLoading("#gDialog"); $("#gDialog").html(sHref); $.get(sHref, function(data) { - loading("#gDialog"); + showLoading("#gDialog"); $("#gDialog").html(data); var parent = $("#gDialog").parent().parent(); parent.css("opacity", "0.0"); @@ -54,31 +53,26 @@ function openDialog(element, on_success) { if (parent.width() < 400) { parent.css("width", 400); } - parent.css({"position": "fixed", - "top": $(window).height() / 2 - parent.height() / 2, - "left": $(window).width() / 2 - parent.width() / 2, - "opacity": "1.0" - }); - + parent.css({"opacity": "1.0"}); ajaxify_dialog = function() { $("#gDialog form").ajaxForm({ - dataType: "json", - success: function(data) { - if (data.form) { - $("#gDialog form").replaceWith(data.form); - ajaxify_dialog(); - } - if (data.result == "success") { - $("#gDialog").dialog("close"); - if (on_success) { - on_success(); - } else if (data.location) { - window.location = data.location; - } else { - window.location.reload(); - } - } - } + dataType: "json", + success: function(data) { + if (data.form) { + $("#gDialog form").replaceWith(data.form); + ajaxify_dialog(); + } + if (data.result == "success") { + $("#gDialog").dialog("close"); + if (on_success) { + on_success(); + } else if (data.location) { + window.location = data.location; + } else { + window.location.reload(); + } + } + } }); }; ajaxify_dialog(); @@ -91,7 +85,7 @@ function openDialog(element, on_success) { * * @param element ID to which to apply the loading class, including # */ -function loading(element) { +function showLoading(element) { var size; switch (element) { case "#gDialog": |