Sha256: 0192248d6e98b1297f42c4a2146cf45d754e6cf863f4db41377cf8d6fa2cb1fe

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 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');
        li.children('.collapse').addClass('show');
      }
    });

    // 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

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-hierarchy-6.4.0 app/assets/javascripts/blacklight/hierarchy/hierarchy.js
blacklight-hierarchy-6.3.0 app/assets/javascripts/blacklight/hierarchy/hierarchy.js
blacklight-hierarchy-6.2.2 app/assets/javascripts/blacklight/hierarchy/hierarchy.js
blacklight-hierarchy-6.2.1 app/assets/javascripts/blacklight/hierarchy/hierarchy.js