Sha256: a3be7752bca90d29936d37efe7ba1ddaf83497c00b4985c78f936ea25d31b702

Contents?: true

Size: 1.55 KB

Versions: 11

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

module Blacklight::HierarchyHelper
  def facet_toggle_button(field_name, described_by, controls)
    aria_label = I18n.t(
      "blacklight.hierarchy.#{field_name}_toggle_aria_label",
      default: :'blacklight.hierarchy.toggle_aria_label'
    )

    # For Rails 5.2 support all options must be symbols.  See https://github.com/rails/rails/issues/39813
    tag.button(aria: {
                 expanded: 'false',
                 label: aria_label,
                 describedby: described_by,
                 controls: controls
               },
               data: {
                 action: 'click->b-h-collapsible#toggle',
                 toggle: 'collapse',
                 bs_toggle: 'collapse',
                 target: "##{controls}",
                 bs_target: "##{controls}"
               },
               class: 'toggle-handle') do
      tag.div( :'aria-hidden' => 'true', class: 'closed toggle-icon') +
      tag.div( :'aria-hidden' => 'true', class: 'opened toggle-icon')
    end
  end

  # --------------------------------------------------------------------------------------------------------------------------------
  # below are methods pertaining to the "rotate" notion where you may want to look at the same tree data organized another way
  # --------------------------------------------------------------------------------------------------------------------------------

  def facet_after(prefix, order)
    orders = blacklight_config.facet_display[:hierarchy][prefix]
    orders[orders.index(order) + 1] || orders.first
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
blacklight-hierarchy-6.4.0 app/helpers/blacklight/hierarchy_helper.rb
blacklight-hierarchy-6.3.0 app/helpers/blacklight/hierarchy_helper.rb
blacklight-hierarchy-6.2.2 app/helpers/blacklight/hierarchy_helper.rb
blacklight-hierarchy-6.2.1 app/helpers/blacklight/hierarchy_helper.rb
blacklight-hierarchy-6.2.0 app/helpers/blacklight/hierarchy_helper.rb
blacklight-hierarchy-6.1.2 app/helpers/blacklight/hierarchy_helper.rb
blacklight-hierarchy-6.1.1 app/helpers/blacklight/hierarchy_helper.rb
blacklight-hierarchy-6.1.0 app/helpers/blacklight/hierarchy_helper.rb
blacklight-hierarchy-6.0.2 app/helpers/blacklight/hierarchy_helper.rb
blacklight-hierarchy-6.0.1 app/helpers/blacklight/hierarchy_helper.rb
blacklight-hierarchy-6.0.0 app/helpers/blacklight/hierarchy_helper.rb