From 03bf3a6af26a5311ab0411616911c443332a8821 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 26 Nov 2008 05:08:43 +0000 Subject: Remove the more or less links --- modules/tag/controllers/tag.php | 7 ++----- modules/tag/helpers/tag.php | 3 +-- modules/tag/helpers/tag_block.php | 5 ----- modules/tag/js/tag.js | 24 ------------------------ modules/tag/tests/Tag_Test.php | 31 +++++++++---------------------- modules/tag/views/tag_block.html.php | 13 ------------- 6 files changed, 12 insertions(+), 71 deletions(-) delete mode 100644 modules/tag/js/tag.js (limited to 'modules/tag') diff --git a/modules/tag/controllers/tag.php b/modules/tag/controllers/tag.php index e6bdbfe4..21117150 100644 --- a/modules/tag/controllers/tag.php +++ b/modules/tag/controllers/tag.php @@ -24,10 +24,7 @@ class Tag_Controller extends REST_Controller { * @see Rest_Controller::_index() */ public function _index() { - $filter = valid::digit($_GET["filter"]) ? $_GET["filter"] : null; - $filter = ($filter <= 0) ? 1 : - ($filter >= tag::$NUMBER_OF_BUCKETS ? tag::$NUMBER_OF_BUCKETS - 1 : $filter); - print tag_block::sidebar_blocks(null, $filter); + throw new Exception("@todo Comment_Controller::_form NOT IMPLEMENTED"); } /** @@ -58,7 +55,7 @@ class Tag_Controller extends REST_Controller { // @todo Production this code // 1) Add security checks throw new Exception("@todo Tag_Controller::_delete NOT IMPLEMENTED"); - } + } public function _update($tag) { // @todo Productionize this diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index 70448527..4e3c0643 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -60,10 +60,9 @@ class tag_Core { * array("id" => "tag_id", "name" => "tag_name", "count" => "frequency", * "class" => "bucket") */ - public static function load_buckets($filter=1) { + public static function load_buckets() { $tag_list = array(); $tags = ORM::factory("tag") - ->where("count >=", $filter) ->orderby("count", "ASC") ->find_all() ->as_array(); diff --git a/modules/tag/helpers/tag_block.php b/modules/tag/helpers/tag_block.php index 23a9e276..6adf5ca6 100644 --- a/modules/tag/helpers/tag_block.php +++ b/modules/tag/helpers/tag_block.php @@ -19,11 +19,6 @@ */ class tag_block_Core { - public static function head($theme) { - $url = url::file("modules/tag/js/tag.js"); - return ""; - } - public static function sidebar_blocks($theme, $filter=1) { $block = new Block(); $block->id = "gTag"; diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js deleted file mode 100644 index 6157b81b..00000000 --- a/modules/tag/js/tag.js +++ /dev/null @@ -1,24 +0,0 @@ -$("document").ready(function() { - $("#gTagLess").click(function(event){ - event.preventDefault(); - get_tag_block($("#gTagLess").attr("href")); - }); - $("#gTagMore").click(function(event){ - event.preventDefault(); - get_tag_block($("#gTagMore").attr("href")); - }); -}); - -function get_tag_block(url) { - $.get(url, function(data) { - $('#gTag').html(data); - $("#gTagLess").click(function(event){ - event.preventDefault(); - get_tag_block($("#gTagLess").attr("href")); - }); - $("#gTagMore").click(function(event){ - event.preventDefault(); - get_tag_block($("#gTagMore").attr("href")); - }); - }); -} diff --git a/modules/tag/tests/Tag_Test.php b/modules/tag/tests/Tag_Test.php index 0a7f878c..1a4f7698 100644 --- a/modules/tag/tests/Tag_Test.php +++ b/modules/tag/tests/Tag_Test.php @@ -51,30 +51,17 @@ class Tag_Test extends Unit_Test_Case { } $tag_list = tag::load_buckets(); - Kohana::log("debug", print_r($tag_list, true)); + $expected_tag_list = array( - array("name" => "tag0", "count" => 8, "class" => 5), - array("name" => "tag1", "count" => 9, "class" => 6), - array("name" => "tag2", "count" => 6, "class" => 4), - array("name" => "tag3", "count" => 5, "class" => 3), - array("name" => "tag4", "count" => 4, "class" => 2), - array("name" => "tag5", "count" => 3, "class" => 1), - array("name" => "tag6", "count" => 2, "class" => 0), - array("name" => "tag7", "count" => 1, "class" => 0) + array("id" => "2", "name" => "tag0", "count" => 8, "class" => 5), + array("id" => "1", "name" => "tag1", "count" => 9, "class" => 6), + array("id" => "3", "name" => "tag2", "count" => 6, "class" => 4), + array("id" => "4", "name" => "tag3", "count" => 5, "class" => 3), + array("id" => "5", "name" => "tag4", "count" => 4, "class" => 2), + array("id" => "6", "name" => "tag5", "count" => 3, "class" => 1), + array("id" => "7", "name" => "tag6", "count" => 2, "class" => 0), + array("id" => "8", "name" => "tag7", "count" => 1, "class" => 0) ); $this->assert_equal($expected_tag_list, $tag_list, "incorrect non filtered tag list"); - - $tag_list = tag::load_buckets(2); - Kohana::log("debug", print_r($tag_list, true)); - $expected_tag_list = array( - array("name" => "tag0", "count" => 8, "class" => 5), - array("name" => "tag1", "count" => 9, "class" => 6), - array("name" => "tag2", "count" => 6, "class" => 4), - array("name" => "tag3", "count" => 5, "class" => 3), - array("name" => "tag4", "count" => 4, "class" => 2), - array("name" => "tag5", "count" => 3, "class" => 1), - array("name" => "tag6", "count" => 2, "class" => 0) - ); - $this->assert_equal($expected_tag_list, $tag_list, "incorrect filtered tag list"); } } \ No newline at end of file diff --git a/modules/tag/views/tag_block.html.php b/modules/tag/views/tag_block.html.php index 9334a5ce..485c6d20 100644 --- a/modules/tag/views/tag_block.html.php +++ b/modules/tag/views/tag_block.html.php @@ -1,17 +1,4 @@ -
- - - ">See Less - - 1): ?> - - ">See More - - -
Resizing Tag Cloud...
-
-