summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-11-16 19:23:41 +0000
committerBharat Mediratta <bharat@menalto.com>2008-11-16 19:23:41 +0000
commit1a2cb5ff043d19736f45d2e845eb44bd32305afe (patch)
tree5fbdaddf1fcddfccf86e950cee315b626fd3c8a2 /modules
parentb6de9859223ad4521ea9aef147534607c5a0a4d5 (diff)
Put _method into the edit form's url; Implement Comment::_put() properly
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/controllers/comment.php7
-rw-r--r--modules/comment/helpers/comment.php3
2 files changed, 3 insertions, 7 deletions
diff --git a/modules/comment/controllers/comment.php b/modules/comment/controllers/comment.php
index 4c04e007..9a9ce84e 100644
--- a/modules/comment/controllers/comment.php
+++ b/modules/comment/controllers/comment.php
@@ -44,17 +44,12 @@ class Comment_Controller extends REST_Controller {
* @see Rest_Controller::_put($resource)
*/
public function _put($comment) {
- $comment = ORM::factory('comment');
- $comment->item_id = $item_id;
-
- $form = $this->_get_form($comment);
+ $form = comment::get_edit_form($comment);
if ($form->validate()) {
$comment = ORM::factory('comment');
$comment->author = $this->input->post('author');
$comment->email = $this->input->post('email');
$comment->text = $this->input->post('text');
- $comment->datetime = time();
- $comment->item_id = $this->input->post('item_id');
$comment->save();
return;
}
diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php
index 8352fae4..b5d57829 100644
--- a/modules/comment/helpers/comment.php
+++ b/modules/comment/helpers/comment.php
@@ -66,7 +66,8 @@ class Comment_Core {
}
static function get_edit_form($comment) {
- $form = new Forge(url::site("comment/{$comment->id}"), "", "post", array("id" => "gCommentForm"));
+ $form = new Forge(
+ url::site("comment/{$comment->id}?_method=put"), "", "post", array("id" => "gCommentForm"));
$group = $form->group(_("Edit Comment"));
$group->input("author") ->label(_("Author")) ->id("gAuthor") ->value($comment->author);
$group->input("email") ->label(_("Email")) ->id("gEmail") ->value($comment->email);