Sha256: 9b861c9809417ce5705ff629310713b43a2246efd6a92e2e1705d3a124a4bed6
Contents?: true
Size: 813 Bytes
Versions: 15
Compression:
Stored size: 813 Bytes
Contents
# frozen_string_literal: true module Blacklight module Hierarchy class FacetFieldComponent < ::ViewComponent::Base def initialize(field_name:, tree:, key:) @field_name = field_name @tree = tree @key = key @id = SecureRandom.uuid end attr_reader :field_name, :tree, :key, :id def subset @subset ||= tree.reject { |k, _v| !k.is_a?(String) } end def li_class subset.empty? ? 'h-leaf' : 'h-node' end def controller_name subset.empty? ? '' : 'b-h-collapsible' end def item tree[:_] end def qfacet_selected? config = helpers.facet_configuration_for_field(field_name) helpers.search_state.filter(config).include?(item.qvalue) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems