Skip to content

Commit

Permalink
Merge pull request #268 from projectblacklight/remove_deprecations
Browse files Browse the repository at this point in the history
Remove all deprecated methods, templates, and other behavior
  • Loading branch information
jrochkind authored Nov 7, 2024
2 parents bc215a5 + 41f0e8c commit 5afdde1
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 195 deletions.
130 changes: 0 additions & 130 deletions app/helpers/range_limit_helper.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ def range_limit_label_key
# A method that is meant to be overridden downstream to format how a range
# label might be displayed to a user. By default it just returns the value.
def format_range_display_value(value)
if view_context.method(:format_range_display_value).owner == RangeLimitHelper
value
else
Deprecation.warn(BlacklightRangeLimit, 'Helper method #format_range_display_value has been overridden; implement a custom FacetItemPresenter instead')
view_context.format_range_display_value(value, key)
end
value
end
end
end
8 changes: 0 additions & 8 deletions app/views/blacklight_range_limit/_range_segments.html.erb

This file was deleted.

1 change: 0 additions & 1 deletion app/views/blacklight_range_limit/range_segments.html.erb

This file was deleted.

1 change: 0 additions & 1 deletion app/views/catalog/range_limit_panel.html.erb

This file was deleted.

1 change: 0 additions & 1 deletion blacklight_range_limit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Gem::Specification.new do |s|

s.add_dependency 'blacklight', '>= 7.25.2', '< 9'
s.add_dependency 'view_component', ">= 2.54", "< 4"
s.add_dependency 'deprecation'

s.add_development_dependency 'rspec', '~> 3.0'
s.add_development_dependency 'rspec-rails'
Expand Down
23 changes: 0 additions & 23 deletions lib/blacklight_range_limit.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# BlacklightRangeLimit
require 'deprecation'

module BlacklightRangeLimit
extend Deprecation

require 'blacklight_range_limit/facet_field_config_override'
require 'blacklight_range_limit/range_limit_builder'
require 'blacklight_range_limit/controller_override'
Expand All @@ -23,25 +19,6 @@ class InvalidRange < TypeError; end
submit: 'submit btn btn-sm btn-secondary'
}

# Add element to array only if it's not already there
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

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

def self.default_range_config
{
range: true,
Expand Down
26 changes: 1 addition & 25 deletions lib/blacklight_range_limit/controller_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,12 @@
require 'blacklight_range_limit/segment_calculation'
module BlacklightRangeLimit
module ControllerOverride
extend Deprecation
extend ActiveSupport::Concern

RANGE_LIMIT_FIELDS = [:range_end, :range_field, :range_start].freeze

included do
before_action do
template = lookup_context.find_all('blacklight_range_limit/range_limit_panel', lookup_context.prefixes + [""], true, [:field_name], {}).first

if template
fields = blacklight_config.facet_fields.select { |_k, v| v.range && !v.had_existing_component_configuration }

fields.each_value do |facet_config|
Deprecation.warn(BlacklightRangeLimit, 'Found partial blacklight_range_limit/range_limit_panel, so falling back to legacy behavior.') unless facet_config.partial
facet_config.partial ||= 'blacklight_range_limit/range_limit_panel'
facet_config.component = nil
end
else
fields = blacklight_config.facet_fields.select { |_k, v| v.partial == 'blacklight_range_limit/range_limit_panel' }
fields.each_value do |facet_config|
Deprecation.warn(BlacklightRangeLimit, 'Ignoring partial configuration for missing blacklight_range_limit/range_limit_panel partial')
facet_config.partial = nil
end
end

# Blacklight 7.25+: Allow range limit params if necessary
if blacklight_config.search_state_fields
missing_keys = RANGE_LIMIT_FIELDS - blacklight_config.search_state_fields
Expand Down Expand Up @@ -59,12 +40,7 @@ def range_limit

@presenter = (@facet.presenter || BlacklightRangeLimit::FacetFieldPresenter).new(@facet, display_facet, view_context)

render 'blacklight_range_limit/range_segments', locals: { facet_field: @presenter }, layout: !request.xhr?
end

def range_limit_panel
Deprecation.warn(BlacklightRangeLimit::ControllerOverride, 'range_limit_panel is deprecated; use the normal facet modal route instead')
facet
render BlacklightRangeLimit::RangeSegmentsComponent.new(facet_field: @presenter), layout: !request.xhr?
end

class_methods do
Expand Down

0 comments on commit 5afdde1

Please sign in to comment.