From beb63a83804e57050a23b3a90ebed93be41b6769 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 6 Nov 2009 23:05:20 -0800 Subject: Clean up the In place edit api: 1) Only allow 1 in place edit to be active at a time (gets around the issue of using an id to identify the form 2) remove the add_ prefix from some of the api methods 3) clean up inconsistent naming --- modules/tag/controllers/admin_tags.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'modules/tag/controllers') diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php index d79f697c..67587c2e 100644 --- a/modules/tag/controllers/admin_tags.php +++ b/modules/tag/controllers/admin_tags.php @@ -70,7 +70,7 @@ class Admin_Tags_Controller extends Admin_Controller { $tag = ORM::factory("tag", $id); if ($tag->loaded) { print InPlaceEdit::factory($tag->name) - ->add_action("admin/tags/rename/$id") + ->action("admin/tags/rename/$id") ->render(); } } @@ -83,15 +83,15 @@ class Admin_Tags_Controller extends Admin_Controller { kohana::show_404(); } - $inplaceedit = InPlaceEdit::factory($tag->name) - ->add_action("admin/tags/rename/$tag->id") - ->add_rules(array("required", "length[1,64]")) - ->add_messages(array("in_use" => t("There is already a tag with that name"))) - ->add_callback(array($this, "check_for_duplicate")); + $in_place_edit = InPlaceEdit::factory($tag->name) + ->action("admin/tags/rename/$tag->id") + ->rules(array("required", "length[1,64]")) + ->messages(array("in_use" => t("There is already a tag with that name"))) + ->callback(array($this, "check_for_duplicate")); - if ($inplaceedit->validate()) { + if ($in_place_edit->validate()) { $old_name = $tag->name; - $tag->name = $inplaceedit->value(); + $tag->name = $in_place_edit->value(); $tag->save(); $message = t("Renamed tag %old_name to %new_name", @@ -101,7 +101,7 @@ class Admin_Tags_Controller extends Admin_Controller { print json_encode(array("result" => "success")); } else { - print json_encode(array("result" => "error", "form" => $inplaceedit->render())); + print json_encode(array("result" => "error", "form" => $in_place_edit->render())); } } -- cgit v1.2.3