diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-07-13 12:30:03 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-07-13 12:30:03 -0700 |
commit | 887154a3b797eade36c1c651e2e849c613459544 (patch) | |
tree | 835214c5c76dbfa2b1de584a6f3f58235a0009ad /lib | |
parent | 5eb4b8ff6cae33d83cfef8ea3d41cba4352e65d8 (diff) | |
parent | 69dfb51490b62bd639c8e09461fad15f4fb51650 (diff) |
Merge branch 'master' of github.com:gallery/gallery3
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gallery.dialog.js | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index 6ec8c634..1d0eae7e 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -1,3 +1,4 @@ + (function($) { $.widget("ui.gallery_dialog", { _init: function() { @@ -26,8 +27,9 @@ $("#g-dialog").gallery_show_loading(); - $.get(sHref, function(data) { - $("#g-dialog").html(data).gallery_show_loading(); + var url = sHref + (sHref.indexOf("?") == -1 ? "?" : "&") + "g-in-dialog"; + $.getJSON(url, function(data) { + $("#g-dialog").html(unescape(data.form)).gallery_show_loading(); if ($("#g-dialog form").length) { self.form_loaded(null, $("#g-dialog form")); @@ -35,15 +37,7 @@ self._layout(); $("#g-dialog").dialog("open"); - // Remove titlebar for progress dialogs or set title - if ($("#g-dialog #g-progress").length) { - $(".ui-dialog-titlebar").remove(); - } else if ($("#g-dialog h1").length) { - $("#g-dialog").dialog('option', 'title', $("#g-dialog h1:eq(0)").html()); - $("#g-dialog h1:eq(0)").hide(); - } else if ($("#g-dialog fieldset legend").length) { - $("#g-dialog").dialog('option', 'title', $("#g-dialog fieldset legend:eq(0)").html()); - } + self._set_title(); if ($("#g-dialog form").length) { self._ajaxify_dialog(); @@ -117,8 +111,10 @@ if (data.form) { var formData = unescape(data.form); $("#g-dialog form").replaceWith(formData); + $("#g-dialog").dialog("option", "position", "center"); $("#g-dialog form :submit").removeClass("ui-state-disabled") .attr("disabled", null); + self._set_title(); self._ajaxify_dialog(); self.form_loaded(null, $("#g-dialog form")); if (typeof data.reset == 'function') { @@ -136,6 +132,18 @@ }); }, + _set_title: function() { + // Remove titlebar for progress dialogs or set title + if ($("#g-dialog #g-progress").length) { + $(".ui-dialog-titlebar").remove(); + } else if ($("#g-dialog h1").length) { + $("#g-dialog").dialog('option', 'title', $("#g-dialog h1:eq(0)").html()); + $("#g-dialog h1:eq(0)").hide(); + } else if ($("#g-dialog fieldset legend").length) { + $("#g-dialog").dialog('option', 'title', $("#g-dialog fieldset legend:eq(0)").html()); + } + }, + form_closing: function(event, ui) {}, dialog_closing: function(event, ui) {} }); |