Sha256: 950ac4199105056ff514c05a835bfb244ba2fb7869d276721821d9f4ab9f58f5
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 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.span(Blacklight::Hierarchy::Engine.config.closed_icon, :'aria-hidden' => 'true', class: 'closed') + tag.span(Blacklight::Hierarchy::Engine.config.opened_icon, :'aria-hidden' => 'true', class: 'opened') 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blacklight-hierarchy-5.4.0 | app/helpers/blacklight/hierarchy_helper.rb |