diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-24 00:20:26 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-24 00:20:26 +0000 |
commit | 672eca53371b131484d00cbe6a069092d0b7f6b3 (patch) | |
tree | 507cce76fc6dc9d022455eed9075e039fa779da2 /themes/default/js/ui.init.js | |
parent | c76d730a7c07253e7cc3224a78c616ce63989f40 (diff) |
Lots of deltas rolled up into a bigger change. Sorry for the mess.
1) Deleted in-place-editing. We'll be replacing this with a real edit
system that groups settings together and is more coherent.
2) Tweaked the way that dialog boxes work to get the ajax stuff working
again. It's imperfect and does not work properly for uploading images.
This is going to get redone also, but this is a good resting point.
3) Created edit forms for albums and photos. Moved _update and _create out
of Items_Controller and into the individual subclasses.
4) Created access::required which is a shorthand for:
if (!access::can(...)) {
access::forbidden();
}
5) Added validation rules to Items_Model
6) Converted login to use the regular modal dialog approach in the theme.
Diffstat (limited to 'themes/default/js/ui.init.js')
-rw-r--r-- | themes/default/js/ui.init.js | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index f4a7c49c..b816dc46 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -105,28 +105,23 @@ function openDialog(element) { $("body").append(eDialog); var buttons = {}; - var form = $("#gDialog").find("form"); - var ajaxify_dialog = function() { - $(form).ajaxForm({ + buttons["Submit"] = function() { + $("#gDialog form").ajaxForm({ complete: function(xhr, statusText) { if (xhr.status == 201) { $("#gDialog").dialog("close"); window.location = xhr.getResponseHeader("Location"); + } else if (xhr.status == 202) { + $("#gDialog").dialog("close"); + window.location.reload(); } else { - $("#gDialog").replaceWith(data.responseText); - ajaxify_dialog(); + $("#gDialog form").replaceWith(xhr.responseText); } } - }); - }; - ajaxify_dialog(); - buttons["Submit"] = function() { - var form = $("#gDialog").find("form"); - form[0].submit(); + }).submit(); }; buttons["Reset"] = function() { - var form = $("#gDialog").find("form"); - form[0].reset(); + $("#gDialog form").reset(); }; $("#gDialog").dialog({ @@ -160,7 +155,7 @@ function openDialog(element) { // Resize height if content's shorter than dialog if (contentHt < $("#gDialog").data("height.dialog")) { $(".ui-dialog").animate({height: contentHt}); - } + }; }); return false; } |