From 9b73213693d2e0b5040d01dbed0ce6b5d75e6587 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Sun, 22 Feb 2009 08:05:15 +0000 Subject: Add Cancel link next to submit buttons in dialogs. Apply button style to buttons in dialogs. --- lib/gallery.dialog.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'lib/gallery.dialog.js') diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index ce48d995..8658f0fb 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -24,6 +24,7 @@ function openDialog(element, on_success) { var sHref = $(element).attr("href"); var sTitle = $(element).attr("title"); var eDialog = '
'; + var eCancel = 'Cancel'; var dialogWidth; $("body").append(eDialog); @@ -33,9 +34,7 @@ function openDialog(element, on_success) { autoResize: true, modal: true, resizable: false, - close: function (event, ui) { - $("#gDialog").dialog("destroy").remove(); - } + close: closeDialog }); showLoading("#gDialog"); @@ -55,6 +54,18 @@ function openDialog(element, on_success) { dialogWidth = 500; } $("#gDialog").dialog('option', 'width', dialogWidth); + if ($("#gDialog .submit").length) { + $("#gDialog .submit").addClass("ui-state-default ui-corner-all"); + $("#gDialog .submit").parent().append(eCancel); + } + $("#gDialog .ui-state-default").hover( + function(){ + $(this).addClass("ui-state-hover"); + }, + function(){ + $(this).removeClass("ui-state-hover"); + } + ); $("#gDialog").dialog("open"); // Remove titlebar for progress dialogs or set title if ($("#gDialog #gProgress").length) { @@ -91,6 +102,9 @@ function openDialog(element, on_success) { return false; } +function closeDialog() { + $("#gDialog").dialog("destroy").remove(); +} /** * Toggle the processing indicator, both large and small * @param elementID Target ID, including #, to apply .gLoadingSize -- cgit v1.2.3