Class: BlacklightRangeLimit::RangeFormComponent

Inherits:
Blacklight::Component
  • Object
show all
Defined in:
app/components/blacklight_range_limit/range_form_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(facet_field:, classes: BlacklightRangeLimit.classes) ⇒ RangeFormComponent

Returns a new instance of RangeFormComponent.



7
8
9
10
# File 'app/components/blacklight_range_limit/range_form_component.rb', line 7

def initialize(facet_field:, classes: BlacklightRangeLimit.classes)
  @facet_field = facet_field
  @classes = classes
end

Instance Method Details

#begin_input_nameObject



20
21
22
# File 'app/components/blacklight_range_limit/range_form_component.rb', line 20

def begin_input_name
  "range[#{@facet_field.key}][begin]"
end

#begin_value_defaultObject



12
13
14
# File 'app/components/blacklight_range_limit/range_form_component.rb', line 12

def begin_value_default
  @facet_field.selected_range.is_a?(Range) ? @facet_field.selected_range.begin : @facet_field.min
end

#end_input_nameObject



24
25
26
# File 'app/components/blacklight_range_limit/range_form_component.rb', line 24

def end_input_name
  "range[#{@facet_field.key}][end]"
end

#end_value_defaultObject



16
17
18
# File 'app/components/blacklight_range_limit/range_form_component.rb', line 16

def end_value_default
  @facet_field.selected_range.is_a?(Range) ? @facet_field.selected_range.end : @facet_field.max
end