diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-11-25 08:05:21 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-11-25 08:12:50 -0800 |
commit | 4c3b9e363ab1501bf3169d92f5606abf464c2d5e (patch) | |
tree | 1be0d88b900558895b0e7e1bb5f513fbff6b1348 /modules/comment/helpers | |
parent | 82ee5f9d338017c69331b2907f37a468ced8c66e (diff) |
Refactor the comment module as part of ticket: #917 "Remove Rest Controller"
* Remove the methods create, update, delete, get_edit_form as there are not used
* Change the return when a comment is created to return the html for the new comment.
This saves a second get request to down load the comment.
Diffstat (limited to 'modules/comment/helpers')
-rw-r--r-- | modules/comment/helpers/comment.php | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index 35685d8c..1e1e7d2f 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -65,7 +65,7 @@ class comment_Core { } static function get_add_form($item) { - $form = new Forge("comments", "", "post", array("id" => "g-comment-form")); + $form = new Forge("comments/create/{$item->id}", "", "post", array("id" => "g-comment-form")); $group = $form->group("add_comment")->label(t("Add comment")); $group->input("name") ->label(t("Name")) ->id("g-author"); $group->input("email") ->label(t("Email (hidden)")) ->id("g-email"); @@ -87,29 +87,5 @@ class comment_Core { return $form; } - - static function get_edit_form($comment) { - $form = new Forge("comments/{$comment->id}?_method=put", "", "post", - array("id" => "g-edit-comment-form")); - $group = $form->group("edit_comment")->label(t("Edit comment")); - $group->input("name") ->label(t("Author")) ->id("g-author"); - $group->input("email") ->label(t("Email (hidden)")) ->id("g-email"); - $group->input("url") ->label(t("Website (hidden)"))->id("g-url"); - $group->textarea("text")->label(t("Comment")) ->id("g-text"); - $group->submit("")->value(t("Edit")); - - $group->text = $comment->text; - $author = $comment->author(); - if ($author->guest) { - $group->inputs["name"]->value = $comment->guest_name; - $group->email = $comment->guest_email; - $group->url = $comment->guest_url; - } else { - $group->inputs["name"]->value($author->full_name)->disabled("disabled"); - $group->email->value($author->email)->disabled("disabled"); - $group->url->value($author->url)->disabled("disabled"); - } - return $form; - } } |