Module: BlacklightRangeLimit

Extended by:
Deprecation
Defined in:
lib/blacklight_range_limit/segment_calculation.rb,
lib/blacklight_range_limit.rb,
lib/blacklight_range_limit/engine.rb,
lib/blacklight_range_limit/routes.rb,
lib/blacklight_range_limit/version.rb,
lib/blacklight_range_limit/route_sets.rb,
lib/blacklight_range_limit/controller_override.rb,
lib/blacklight_range_limit/range_limit_builder.rb,
app/presenters/blacklight_range_limit/filter_field.rb,
lib/blacklight_range_limit/routes/range_searchable.rb,
lib/blacklight_range_limit/facet_field_config_override.rb,
lib/generators/blacklight_range_limit/assets_generator.rb,
lib/generators/blacklight_range_limit/install_generator.rb,
app/components/blacklight_range_limit/range_form_component.rb,
app/presenters/blacklight_range_limit/facet_item_presenter.rb,
app/components/blacklight_range_limit/range_facet_component.rb,
app/presenters/blacklight_range_limit/facet_field_presenter.rb,
app/components/blacklight_range_limit/range_segments_component.rb

Overview

Meant to be in a Controller, included in our ControllerOverride module.

Defined Under Namespace

Modules: ControllerOverride, FacetFieldConfigOverride, RangeLimitBuilder, RouteSets, Routes, SegmentCalculation Classes: AssetsGenerator, Engine, FacetFieldPresenter, FacetItemPresenter, FilterField, InstallGenerator, InvalidRange, RangeFacetComponent, RangeFormComponent, RangeSegmentsComponent

Constant Summary collapse

VERSION =
self.version

Class Method Summary collapse

Class Method Details

.default_range_configObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/blacklight_range_limit.rb', line 45

def self.default_range_config
  {
    range: true,
    range_config: {
      num_segments: 10,
      chart_js: true,
      slider_js: true,
      segments: true,
      assumed_boundaries: nil,
      maxlength: nil,
      input_label_range_begin: nil,
      input_label_range_end: nil
    },
    filter_class: BlacklightRangeLimit::FilterField,
    presenter: BlacklightRangeLimit::FacetFieldPresenter,
    item_presenter: BlacklightRangeLimit::FacetItemPresenter,
    component: BlacklightRangeLimit::RangeFacetComponent
  }
end

.range_config(blacklight_config, solr_field) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/blacklight_range_limit.rb', line 32

def self.range_config(blacklight_config, solr_field)
  Deprecation.warn(BlacklightRangeLimit, 'BlacklightRangeLimit.range_config is deprecated without replacement')
  field = blacklight_config.facet_fields[solr_field.to_s]

  return false unless field&.range

  if field.range == true
    default_range_config
  else
    field.range.merge(partial: field.partial)
  end
end

.safe_arr_add(array, element) ⇒ Object

Add element to array only if it’s not already there



27
28
29
30
# File 'lib/blacklight_range_limit.rb', line 27

def self.safe_arr_add(array, element)
  Deprecation.warn(BlacklightRangeLimit, 'BlacklightRangeLimit.safe_arr_add is deprecated without replacement')
  array << element unless array.include?(element)
end

.versionObject



3
4
5
# File 'lib/blacklight_range_limit/version.rb', line 3

def self.version
  @version ||= File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).chomp
end