You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by rj...@apache.org on 2013/02/08 08:41:12 UTC
svn commit: r1443860 -
/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_admin_plugins.html
Author: rjollos
Date: Fri Feb 8 07:41:12 2013
New Revision: 1443860
URL: http://svn.apache.org/r1443860
Log:
Refs #372: Added a select-all (group toggling) checkbox to each plugin on the webadmin panel. The checkbox toggles the component checkboxes and has tri-state behavior.
Modified:
incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_admin_plugins.html
Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_admin_plugins.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_admin_plugins.html?rev=1443860&r1=1443859&r2=1443860&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_admin_plugins.html (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_admin_plugins.html Fri Feb 8 07:41:12 2013
@@ -29,6 +29,33 @@
<title>Plugins</title>
<script type="text/javascript"
src="${href.chrome('dashboard/js/bootstrap-collapse.js')}"></script>
+ <script type="text/javascript">/*<![CDATA[*/
+ jQuery(document).ready(function($) {
+ // Sets state of group toggler when component checkboxes are clicked
+ function setGroupTogglerState() {
+ var table = $(this).closest("table.table");
+ var checkboxes = $("td.sel input:checkbox:enabled", table);
+ var numSelected = checkboxes.filter(":checked").length;
+ var noneSelected = numSelected === 0;
+ var allSelected = numSelected === checkboxes.length;
+ $("th.sel input:checkbox", table)
+ .prop({"checked": allSelected,
+ "indeterminate": !(noneSelected || allSelected)});
+ }
+ // Add group event behavior for controlling state of toggler
+ $("table.table td.sel input:checkbox:enabled")
+ .click(setGroupTogglerState);
+ // Add click behavior for the group toggler and initialize its state
+ $("table.table th.sel").each(function() {
+ $(this).attr("title", $(this).text())
+ }).html('<input type="checkbox" />')
+ .children()
+ .click(function() {
+ $("td.sel input:checkbox:enabled",
+ $(this).closest("table.table")).prop("checked", this.checked);
+ }).each(setGroupTogglerState);
+ });
+ /*]]>*/</script>
</head>
<body>