diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-25 05:12:46 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-25 05:12:46 +0000 |
commit | fdc0f83024ee8a10f223132d9e02a9e10466e46a (patch) | |
tree | 38dc87629f8063ac3997edbd2a852c318ffb089f /modules/comment/js/comment.js | |
parent | 6e68c5ca28e52773fca16e77aecdde2b92351af2 (diff) |
Big round of normalization of the way that our controllers
communicate. Almost all controllers now use JSON to speak to the
theme when we're dealing with form processing. This means tht we only
send the form back and forth, but we use a JSON protocol to tell the
browser success/error status as well as the location of any newly
created resources, or where the browser should redirect the user.
Lots of small changes:
1) Admin -> Edit Profile is gone. Instead I fixed the "Modify Profile" link
in the top right corner to be a modal dialog
2) We use json_encode everywhere. No more Atom/XML for now. We can bring those
back later, though. For now there's a lot of code duplication but that'll be
easy to clean up.
3) REST_Controller is no longer abstract. All methods its subclasses should create
throw exceptions, which means that subclasses don't have to implement stubs for
those methods.
4) New pattern: helper method get_add_form calls take an Item_Model,
not an id since we have to load the Item_Model in the controller
anyway to check permissions.
5) User/Groups REST resources are separate from User/Group in the site
admin. They do different things, we should avoid confusing overlap.
Diffstat (limited to 'modules/comment/js/comment.js')
-rw-r--r-- | modules/comment/js/comment.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/comment/js/comment.js b/modules/comment/js/comment.js index 3ae23f62..c9cfeb08 100644 --- a/modules/comment/js/comment.js +++ b/modules/comment/js/comment.js @@ -6,8 +6,10 @@ function ajaxify_comment_form() { $("#gComments form").ajaxForm({ dataType: "json", success: function(data) { - $("#gComments form").replaceWith(data.form); - ajaxify_comment_form(); + if (data.form) { + $("#gComments form").replaceWith(data.form); + ajaxify_comment_form(); + } if (data.result == "success") { $.get(data.resource, function(data, textStatus) { $("#gComments .gBlockContent ul:first").append("<li>"+data+"</li>"); |