app/helpers/blacklight/hierarchy_helper.rb in blacklight-hierarchy-5.0.0 vs app/helpers/blacklight/hierarchy_helper.rb in blacklight-hierarchy-5.1.0

- old
+ new

@@ -1,18 +1,26 @@ # frozen_string_literal: true module Blacklight::HierarchyHelper - def facet_toggle_button(field_name, described_by) + 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', - :'aria-label' => aria_label, - :'aria-describedby' => described_by, - class: 'toggle-handle') do + tag.button(aria: { + expanded: 'false', + label: aria_label, + describedby: described_by, + controls: controls + }, + data: { + action: 'click->b-h-collapsible#toggle', + toggle: 'collapse', + 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