Module: Blacklight::HierarchyHelper

Defined in:
app/helpers/blacklight/hierarchy_helper.rb

Instance Method Summary collapse

Instance Method Details

#facet_after(prefix, order) ⇒ Object


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




34
35
36
37
# File 'app/helpers/blacklight/hierarchy_helper.rb', line 34

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

#facet_toggle_button(field_name, described_by, controls) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/helpers/blacklight/hierarchy_helper.rb', line 4

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