From 0eb9a2aacd33d9d98726d08f828f10df4e462e9e Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Mon, 29 Jun 2009 20:55:23 -0700 Subject: Fix for ticket 86 - Make Cancel button in doalogs localizable. --- lib/gallery.dialog.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/gallery.dialog.js') diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index 72c7cdf8..6d986aa0 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -50,7 +50,6 @@ function openDialog(element, on_success) { var sHref = $(element).attr("href"); var sTitle = $(element).attr("title"); var eDialog = '
'; - // @todo Fix i18n for Cancel link var dialogWidth; $("body").append(eDialog); @@ -99,7 +98,7 @@ function openDialog(element, on_success) { } function on_form_loaded() { - var eCancel = 'Cancel'; + var eCancel = '' + MSG_CANCEL + ''; if ($("#gDialog .submit").length) { $("#gDialog .submit").addClass("ui-state-default ui-corner-all"); $("#gDialog .submit").parent().append(eCancel); -- cgit v1.2.3 From 21f228b1aed8b32dc9856add51f4ef8a3c7ced95 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Mon, 29 Jun 2009 21:03:40 -0700 Subject: Ticket 86 (addendum) - Guard against themes that don't define MSG_CANCEL and add the message to admin_default as well. --- lib/gallery.dialog.js | 2 ++ themes/admin_default/views/admin.html.php | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'lib/gallery.dialog.js') diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index 6d986aa0..fc66323e 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -98,6 +98,8 @@ function openDialog(element, on_success) { } function on_form_loaded() { + // Should be defined (and localized) in the theme + MSG_CANCEL = MSG_CANCEL || 'Cancel'; var eCancel = '' + MSG_CANCEL + ''; if ($("#gDialog .submit").length) { $("#gDialog .submit").addClass("ui-state-default ui-corner-all"); diff --git a/themes/admin_default/views/admin.html.php b/themes/admin_default/views/admin.html.php index fed1afe6..36deea9e 100644 --- a/themes/admin_default/views/admin.html.php +++ b/themes/admin_default/views/admin.html.php @@ -21,6 +21,10 @@ script("lib/jquery.form.js") ?> script("lib/jquery-ui.js") ?> script("lib/gallery.common.js") ?> + + script("lib/gallery.dialog.js") ?> script("lib/superfish/js/superfish.js") ?> theme_script("js/jquery.dropshadow.js") ?> -- cgit v1.2.3 From 214d977f4dc9ac78f4571a7cc89109fd95f5a2eb Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 11 Jul 2009 06:51:21 -0700 Subject: 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. --- lib/gallery.dialog.js | 13 +++++-------- modules/gallery/js/quick.js | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'lib/gallery.dialog.js') 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 = '
'; @@ -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; } diff --git a/modules/gallery/js/quick.js b/modules/gallery/js/quick.js index 2dcb1c36..3ac97f8e 100644 --- a/modules/gallery/js/quick.js +++ b/modules/gallery/js/quick.js @@ -46,7 +46,7 @@ var quick_do = function(cont, pane, img) { return false; } if (pane.hasClass("gDialogLink")) { - openDialog(pane, function() { window.location.reload(); }); + openDialog(pane); } else { img.css("opacity", "0.1"); cont.addClass("gLoadingLarge"); -- cgit v1.2.3