Sha256: 98a83b8a237f7a15de889337c69b655c8332d93615655f0c5f880d0dfd199afd

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

Blacklight.onLoad(function(){
  Blacklight.do_hierarchical_facet_expand_contract_behavior();
});

(function($) {
  Blacklight.do_hierarchical_facet_expand_contract_behavior = function() {
    $( Blacklight.do_hierarchical_facet_expand_contract_behavior.selector ).each (
        Blacklight.hierarchical_facet_expand_contract
     );
  }
  Blacklight.do_hierarchical_facet_expand_contract_behavior.selector = '[data-controller="b-h-collapsible"]';
  Blacklight.do_hierarchical_facet_expand_contract_behavior.handle = '[data-action="click->b-h-collapsible#toggle"]';
  Blacklight.do_hierarchical_facet_expand_contract_behavior.list = '[data-b-h-collapsible-target="list"]';

  Blacklight.hierarchical_facet_expand_contract = function() {
    var li = $(this);
    li.addClass('twiddle');

    $(Blacklight.do_hierarchical_facet_expand_contract_behavior.list, this).each(function() {
      if($('span.selected', this).length != 0){
        li.addClass('twiddle-open');
      }
    });

    // attach the toggle behavior to the li tag
    li.children(Blacklight.do_hierarchical_facet_expand_contract_behavior.handle).click(function(e){
      li.toggleClass('twiddle-open');
    });
  };
})(jQuery);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blacklight-hierarchy-5.2.0 app/assets/javascripts/blacklight/hierarchy/hierarchy.js
blacklight-hierarchy-5.1.0 app/assets/javascripts/blacklight/hierarchy/hierarchy.js