diff options
author | Chad Kieffer <chad@2tbsp.com> | 2009-02-22 08:05:15 +0000 |
---|---|---|
committer | Chad Kieffer <chad@2tbsp.com> | 2009-02-22 08:05:15 +0000 |
commit | 9b73213693d2e0b5040d01dbed0ce6b5d75e6587 (patch) | |
tree | acd3807488957405d43239292e3cc1115e3d1599 /lib/gallery.dialog.js | |
parent | 9344141231e3c9567d7fb8c6938423178c1b9dee (diff) |
Add Cancel link next to submit buttons in dialogs. Apply button style to buttons in dialogs.
Diffstat (limited to 'lib/gallery.dialog.js')
-rw-r--r-- | lib/gallery.dialog.js | 20 |
1 files changed, 17 insertions, 3 deletions
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 = '<div id="gDialog"></div>'; + var eCancel = '<a href="javascript: closeDialog()" class="gCancel">Cancel</a>'; 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 |