diff options
-rw-r--r-- | modules/tag/controllers/tags.php | 10 | ||||
-rw-r--r-- | modules/tag/helpers/tag.php | 2 | ||||
-rw-r--r-- | modules/tag/js/tag.js | 13 |
3 files changed, 12 insertions, 13 deletions
diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index a09c789d..95d7145d 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -50,15 +50,11 @@ class Tags_Controller extends REST_Controller { $item_id = is_array($parameters) ? $parameters[0] : $parameters; $form = tag::get_add_form($item_id); if ($form->validate()) { - Kohana::log("debug", print_r($this->inputs->post(), true)); - Kohana::log("debug", $form->inputs["text"]->value); - $tags = explode(",", $form->inputs["text"]->value); - Kohana::log("debug", print_r($tags, true)); + $tags = explode(",", $form->inputs["tags"]->value); - $item = ORM::factory("item", $item_id); -// $form->inputs["text"] = "add new tags..."; +// $item = ORM::factory("item", $item_id); + $form->inputs["tags"]->value("add new tags..."); } - Kohana::log("debug", print_r($form, true)); print $form->render(); } diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index 6e8f95f9..09109cd5 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -62,7 +62,7 @@ class tag_Core { public static function get_add_form($item_id) { $form = new Forge(url::site("form/add/tags/$item_id"), "", "post", array("id" => "gAddTag")); - $form->input("text") + $form->input("tags") ->label(_("(Enter tags separated by commas)")) ->id("gNewTags") ->class("text") diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js index 726b8ad2..7b2d32c4 100644 --- a/modules/tag/js/tag.js +++ b/modules/tag/js/tag.js @@ -1,12 +1,15 @@ $("document").ready(function() { - $("#gAddTag").submit(function(event){ - get_tag_block($("#gAddTag").attr("action")); - return false; - }); + var options = { + target: "#gTagFormContainer", + success: function(responseText, statusText) { + $("#gAddTag").ajaxForm(options); + } + }; + $("#gAddTag").ajaxForm(options); }); function get_tag_block(url) { - $.get(url, function(data) { + $.post(url, function(data) { $('#gTagFormContainer').html(data); $("#gAddTag").submit(function(event){ get_tag_block($("#gAddTag").attr("action")); |