web/data/cubicweb.facets.js
changeset 7281 daee8aec3b9b
parent 6551 50ec97e4f9cc
child 7282 f2dbac46031e
--- a/web/data/cubicweb.facets.js	Fri Apr 29 09:08:30 2011 +0200
+++ b/web/data/cubicweb.facets.js	Thu Apr 14 14:41:40 2011 +0200
@@ -238,6 +238,18 @@
     });
 }
 
+// change css class of facets that have a value selected
+function updateFacetTitles() {
+    $('.facet').each(function() {
+        var $divTitle = $(this).find('.facetTitle');
+       var facetSelected = $(this).find('.facetValueSelected');
+       if (facetSelected.length) {
+           $divTitle.addClass('facetTitleSelected');
+       } else {
+           $divTitle.removeClass('facetTitleSelected');
+       }
+    });
+}
 
 // we need to differenciate cases where initFacetBoxEvents is called with one
 // argument or without any argument. If we use `initFacetBoxEvents` as the
@@ -245,4 +257,5 @@
 // his, so we use this small anonymous function instead.
 jQuery(document).ready(function() {
     initFacetBoxEvents();
+    jQuery(cw).bind('facets-content-loading', updateFacetTitles);
 });