aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/js/backend.js
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2012-06-15 22:23:26 +0200
committerKevin Chabowski <kevin@kch42.de>2012-06-15 22:23:26 +0200
commit34809379563a6fc92889965441c56ba29c155947 (patch)
tree532d26edab9f88bf67d888f9e4c23cfde33cf4b6 /ratatoeskr/js/backend.js
parent04b47bc50dd147ad2156a29bdb274049f99d9bce (diff)
downloadratatoeskr-cms-feature-ui-improvements.tar.gz
ratatoeskr-cms-feature-ui-improvements.tar.bz2
ratatoeskr-cms-feature-ui-improvements.zip
Filters in backend are now dynamic.feature-ui-improvements
If JavaScript is activated in the users browser, filterable tables are filtered immediatly.
Diffstat (limited to 'ratatoeskr/js/backend.js')
-rw-r--r--ratatoeskr/js/backend.js38
1 files changed, 38 insertions, 0 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