From 34809379563a6fc92889965441c56ba29c155947 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Fri, 15 Jun 2012 22:23:26 +0200 Subject: Filters in backend are now dynamic. If JavaScript is activated in the users browser, filterable tables are filtered immediatly. --- ratatoeskr/js/backend.js | 38 ++++++ .../templates/src/systemtemplates/articles.html | 142 +++++++++++---------- .../src/systemtemplates/comments_list.html | 142 +++++++++++---------- 3 files changed, 182 insertions(+), 140 deletions(-) diff --git a/ratatoeskr/js/backend.js b/ratatoeskr/js/backend.js index d131bfe..43e2544 100644 --- a/ratatoeskr/js/backend.js +++ b/ratatoeskr/js/backend.js @@ -16,4 +16,42 @@ $(function() $("div.articleeditor-metabar-element-content", self.parent()).show("fast"); } }); + + function filtertable(table, pairs) + { + $.each(pairs, function(idx, pair) + { + input = pair[0]; + column = pair[1]; + + (function(column){input.keyup(function() + { + filterby = $(this).val().toLowerCase(); + $("tbody tr", table).each(function(i) + { + if($("td", this).eq(column).text().toLowerCase().indexOf(filterby) == -1) + $(this).hide() + else + $(this).show(); + }); + });})(column); + }); + } + + $("#articlestable").each(function(i) + { + filtertable( + $("table", this), + [ + [$("input[name=filter_urlname]", this), 1], + [$("input[name=filter_tag]", this), 4], + [$("input[name=filter_section]", this), 5] + ] + ); + }); + + $("#commentstable").each(function(i) + { + filtertable($("table", this), [[$("input[name=filter_article]", this), 7]]); + }); }); \ No newline at end of file diff --git a/ratatoeskr/templates/src/systemtemplates/articles.html b/ratatoeskr/templates/src/systemtemplates/articles.html index 764ac40..558ed48 100644 --- a/ratatoeskr/templates/src/systemtemplates/articles.html +++ b/ratatoeskr/templates/src/systemtemplates/articles.html @@ -3,74 +3,76 @@ -
-
- : - - - - - -
-
- -
- - - - - - - - - - - - ~{$articles_n|gt|0} - - - - - - - - - - - - - - - - - -
  - - <ste:get_translation for='sort_asc' /> - <ste:get_translation for='sort_desc' /> - - - <ste:get_translation for='sort_asc' /> - <ste:get_translation for='sort_desc' /> - - - <ste:get_translation for='sort_asc' /> - <ste:get_translation for='sort_desc' /> -
$article[urlname] - - ?{~{$i|eq|0}||, }$lang - - %Y-%m-%d %H:%M:%S - - ?{~{$i|eq|0}||, } $tag - - $article[section][name]
-
- - -
-
+
+
+
+ : + + + + + +
+
+ +
+ + + + + + + + + + + + ~{$articles_n|gt|0} + + + + + + + + + + + + + + + + + +
  + + <ste:get_translation for='sort_asc' /> + <ste:get_translation for='sort_desc' /> + + + <ste:get_translation for='sort_asc' /> + <ste:get_translation for='sort_desc' /> + + + <ste:get_translation for='sort_asc' /> + <ste:get_translation for='sort_desc' /> +
$article[urlname] + + ?{~{$i|eq|0}||, }$lang + + %Y-%m-%d %H:%M:%S + + ?{~{$i|eq|0}||, } $tag + + $article[section][name]
+
+ + +
+
+
diff --git a/ratatoeskr/templates/src/systemtemplates/comments_list.html b/ratatoeskr/templates/src/systemtemplates/comments_list.html index 5c86a8e..999b455 100644 --- a/ratatoeskr/templates/src/systemtemplates/comments_list.html +++ b/ratatoeskr/templates/src/systemtemplates/comments_list.html @@ -3,74 +3,76 @@ -
-
- : - - - -
-
- -
- - - - - - - - - - - - - - - - ~{$comments_n|gt|0} - - - - - - - - - - - - - - - - - - - -
  - - <ste:get_translation for='sort_asc' /> - <ste:get_translation for='sort_desc' /> - - - <ste:get_translation for='sort_asc' /> - <ste:get_translation for='sort_desc' /> - - - <ste:get_translation for='sort_asc' /> - <ste:get_translation for='sort_desc' /> -
?{$comment[read_by_admin]||}?{$comment[visible]||}$comment[excerpt]... $comment[language]$comment[author]%Y-%m-%d %H:%M:%S$comment[article]
-
- - -
-
+
+
+
+ : + + + +
+
+ +
+ + + + + + + + + + + + + + + + ~{$comments_n|gt|0} + + + + + + + + + + + + + + + + + + + +
  + + <ste:get_translation for='sort_asc' /> + <ste:get_translation for='sort_desc' /> + + + <ste:get_translation for='sort_asc' /> + <ste:get_translation for='sort_desc' /> + + + <ste:get_translation for='sort_asc' /> + <ste:get_translation for='sort_desc' /> +
?{$comment[read_by_admin]||}?{$comment[visible]||}$comment[excerpt]... $comment[language]$comment[author]%Y-%m-%d %H:%M:%S$comment[article]
+
+ + +
+
+
-- cgit v1.2.3-70-g09d2