summaryrefslogtreecommitdiff
path: root/lib/gallery.dialog.js
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-07-11 06:51:21 -0700
committerBharat Mediratta <bharat@menalto.com>2009-07-11 06:51:21 -0700
commit214d977f4dc9ac78f4571a7cc89109fd95f5a2eb (patch)
tree0910b2047d050888b861733f09c9af78100744fa /lib/gallery.dialog.js
parent4d0099e7165a4a1508eea58613cdc75e116464ff (diff)
Don't close the dialog window after we successfully complete an
action. The expectation is that we're going to reload the page (or redirect to a new url). If we close the dialog, then we can trigger the onhover for items we've just deleted causing errors. Simplify the API while we're at it by getting rid of the no-longer-used on_success argument to openDialog() This fixes #528.
Diffstat (limited to 'lib/gallery.dialog.js')
-rw-r--r--lib/gallery.dialog.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js
index fc66323e..74c2f20e 100644
--- a/lib/gallery.dialog.js
+++ b/lib/gallery.dialog.js
@@ -11,23 +11,20 @@ function handleDialogEvent(event) {
event.preventDefault();
}
-function ajaxify_dialog(on_success) {
+function ajaxify_dialog() {
$("#gDialog form").ajaxForm({
dataType: "json",
success: function(data) {
if (data.form) {
$("#gDialog form").replaceWith(data.form);
- ajaxify_dialog(on_success);
+ ajaxify_dialog();
on_form_loaded();
if (typeof data.reset == 'function') {
eval(data.reset + '()');
}
}
if (data.result == "success") {
- $("#gDialog").dialog("close");
- if (on_success) {
- on_success();
- } else if (data.location) {
+ if (data.location) {
window.location = data.location;
} else {
window.location.reload();
@@ -46,7 +43,7 @@ function ajaxify_dialog(on_success) {
* @see handleDialogEvent()
* @see showLoading()
*/
-function openDialog(element, on_success) {
+function openDialog(element) {
var sHref = $(element).attr("href");
var sTitle = $(element).attr("title");
var eDialog = '<div id="gDialog"></div>';
@@ -92,7 +89,7 @@ function openDialog(element, on_success) {
$("#gDialog").dialog('option', 'title', $("#gDialog fieldset legend:eq(0)").html());
}
- ajaxify_dialog(on_success);
+ ajaxify_dialog();
});
return false;
}