web/data/cubicweb.facets.js
changeset 7281 daee8aec3b9b
parent 6551 50ec97e4f9cc
child 7282 f2dbac46031e
equal deleted inserted replaced
7278:1144a2d90314 7281:daee8aec3b9b
   236             });
   236             });
   237         }
   237         }
   238     });
   238     });
   239 }
   239 }
   240 
   240 
       
   241 // change css class of facets that have a value selected
       
   242 function updateFacetTitles() {
       
   243     $('.facet').each(function() {
       
   244         var $divTitle = $(this).find('.facetTitle');
       
   245        var facetSelected = $(this).find('.facetValueSelected');
       
   246        if (facetSelected.length) {
       
   247            $divTitle.addClass('facetTitleSelected');
       
   248        } else {
       
   249            $divTitle.removeClass('facetTitleSelected');
       
   250        }
       
   251     });
       
   252 }
   241 
   253 
   242 // we need to differenciate cases where initFacetBoxEvents is called with one
   254 // we need to differenciate cases where initFacetBoxEvents is called with one
   243 // argument or without any argument. If we use `initFacetBoxEvents` as the
   255 // argument or without any argument. If we use `initFacetBoxEvents` as the
   244 // direct callback on the jQuery.ready event, jQuery will pass some argument of
   256 // direct callback on the jQuery.ready event, jQuery will pass some argument of
   245 // his, so we use this small anonymous function instead.
   257 // his, so we use this small anonymous function instead.
   246 jQuery(document).ready(function() {
   258 jQuery(document).ready(function() {
   247     initFacetBoxEvents();
   259     initFacetBoxEvents();
       
   260     jQuery(cw).bind('facets-content-loading', updateFacetTitles);
   248 });
   261 });