Skip to content

Commit

Permalink
Remove more deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Nov 9, 2015
1 parent 2efbcc0 commit d64f846
Show file tree
Hide file tree
Showing 19 changed files with 3 additions and 121 deletions.
4 changes: 0 additions & 4 deletions app/controllers/concerns/blacklight/search_helper.rb
Expand Up @@ -78,10 +78,6 @@ def fetch(id=nil, extra_controller_params={})
if id.is_a? Array
fetch_many(id, params, extra_controller_params)
else
if id.nil?
Deprecation.warn Blacklight::SearchHelper, "Calling #fetch without an explicit id argument is deprecated and will be removed in Blacklight 6.0"
id ||= params[:id]
end
fetch_one(id, extra_controller_params)
end
end
Expand Down
7 changes: 1 addition & 6 deletions app/helpers/blacklight/render_partials_helper.rb
Expand Up @@ -39,12 +39,7 @@ def render_document_partials(doc, partials = [], locals ={})
# @param [String] base name for the partial
# @param [Hash] locales to pass through to the partials
def render_document_partial(doc, base_name, locals = {})
format = if method(:document_partial_name).arity == 1
Deprecation.warn self, "The #document_partial_name with a single argument is deprecated. Update your override to include a second argument for the 'base name'"
document_partial_name(doc)
else
document_partial_name(doc, base_name)
end
format = document_partial_name(doc, base_name)

view_type = document_index_view_type
template = cached_view ['show', view_type, base_name, format].join('_') do
Expand Down
5 changes: 0 additions & 5 deletions app/helpers/blacklight/url_helper_behavior.rb
Expand Up @@ -12,17 +12,12 @@ def url_for_document(doc, options = {})
end

# link_to_document(doc, 'VIEW', :counter => 3)
# link_to_document(doc, :label=>'VIEW', :counter => 3)
# Use the catalog_path RESTful route to create a link to the show page for a specific item.
# catalog_path accepts a HashWithIndifferentAccess object. The solr query params are stored in the session,
# so we only need the +counter+ param here. We also need to know if we are viewing to document as part of search results.
def link_to_document(doc, field_or_opts = nil, opts={:counter => nil})
if field_or_opts.is_a? Hash
opts = field_or_opts
if opts[:label]
Deprecation.warn self, "The second argument to link_to_document should now be the label."
field = opts.delete(:label)
end
else
field = field_or_opts
end
Expand Down
6 changes: 0 additions & 6 deletions app/models/concerns/blacklight/solr/document.rb
Expand Up @@ -15,12 +15,6 @@
#

module Blacklight::Solr::Document
autoload :SchemaOrg, 'blacklight/solr/document/schema_org'
autoload :DublinCore, 'blacklight/solr/document/dublin_core'
autoload :Email, 'blacklight/solr/document/email'
autoload :Sms, 'blacklight/solr/document/sms'
autoload :Extensions, 'blacklight/solr/document/extensions'
autoload :Export, 'blacklight/solr/document/export'
autoload :MoreLikeThis, 'blacklight/solr/document/more_like_this'

extend ActiveSupport::Concern
Expand Down
7 changes: 0 additions & 7 deletions app/models/concerns/blacklight/solr/document/dublin_core.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/models/concerns/blacklight/solr/document/email.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/models/concerns/blacklight/solr/document/export.rb

This file was deleted.

8 changes: 0 additions & 8 deletions app/models/concerns/blacklight/solr/document/extensions.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/models/concerns/blacklight/solr/document/schema_org.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/models/concerns/blacklight/solr/document/sms.rb

This file was deleted.

18 changes: 2 additions & 16 deletions app/presenters/blacklight/document_presenter.rb
Expand Up @@ -99,29 +99,15 @@ def render_values(values, field_config = nil)
options = {}
options = field_config.separator_options if field_config && field_config.separator_options

if field_config && field_config.separator
Deprecation.warn(self.class, 'The field configuration #separator is deprecated. Use #separator_options instead')
options[:words_connector] ||= field_config.separator
options[:two_words_connector] ||= field_config.separator
options[:last_word_connector] ||= field_config.separator
end

values.map { |x| html_escape(x) }.to_sentence(options).html_safe
end

##
# Render the document index heading
#
# @param [Hash] opts (Deprecated)
# @option opts [Symbol] :label Render the given field from the document
# @option opts [Proc] :label Evaluate the given proc
# @option opts [String] :label Render the given string
# @param [Symbol, Proc, String] field Render the given field or evaluate the proc or render the given string
def render_document_index_label field, opts ={}
if field.is_a? Hash
Deprecation.warn DocumentPresenter, "Calling render_document_index_label with a hash is deprecated"
field = field[:label]
end
# @param [Hash] opts
def render_document_index_label(field, opts = {})
label = case field
when Symbol
@document[field]
Expand Down
2 changes: 0 additions & 2 deletions app/views/catalog/email_sent.html.erb

This file was deleted.

2 changes: 0 additions & 2 deletions app/views/catalog/sms_sent.html.erb

This file was deleted.

1 change: 0 additions & 1 deletion lib/blacklight/configuration.rb
Expand Up @@ -15,7 +15,6 @@ class Configuration < OpenStructWithHashAccess
# XXX this isn't very pretty, but it works.
require_dependency 'blacklight/configuration/fields'
require_dependency 'blacklight/configuration/field'
require_dependency 'blacklight/configuration/solr_field'
require_dependency 'blacklight/configuration/search_field'
require_dependency 'blacklight/configuration/facet_field'
require_dependency 'blacklight/configuration/sort_field'
Expand Down
7 changes: 0 additions & 7 deletions lib/blacklight/configuration/solr_field.rb

This file was deleted.

7 changes: 0 additions & 7 deletions lib/railties/blacklight.rake
Expand Up @@ -22,13 +22,6 @@ namespace :blacklight do
end
end

namespace :solr do
task :seed do
Deprecation.warn Blacklight, "blacklight:solr:seed is deprecated; use blacklight:index:seed instead"
Rake::Task['blacklight:index:seed'].invoke
end
end

namespace :check do
desc "Check the Solr connection and controller configuration"
task :solr, [:controller_name] => [:environment] do |_, args|
Expand Down
9 changes: 0 additions & 9 deletions spec/helpers/blacklight_helper_spec.rb
Expand Up @@ -284,15 +284,6 @@ def current_search_session
allow(helper).to receive(:document_partial_name).with(doc, :xyz)
helper.render_document_partial(doc, :xyz)
end

context "with a 1-arg form of document_partial_name" do
it "should only call the 1-arg form of the document_partial_name" do
allow(helper).to receive(:method).with(:document_partial_name).and_return(double(arity: 1))
allow(helper).to receive(:document_partial_name).with(doc)
allow(Deprecation).to receive(:warn)
helper.render_document_partial(doc, nil)
end
end
end

describe "#document_partial_name" do
Expand Down
7 changes: 0 additions & 7 deletions spec/helpers/url_helper_spec.rb
Expand Up @@ -182,13 +182,6 @@
expect(helper.link_to_document(@document, :title_display)).to have_selector("a", :text => '654321', :count => 1)
end

it "should have the old deprecated behavior (second argument is a hash)" do
data = {'id'=>'123456','title_display'=>['654321'] }
@document = SolrDocument.new(data)
expect(Deprecation).to receive(:warn)
expect(helper.link_to_document(@document, { :label => "title_display" })).to have_selector("a", :text => 'title_display', :count => 1)
end

it "should accept and return a string label" do
data = {'id'=>'123456','title_display'=>['654321'] }
@document = SolrDocument.new(data)
Expand Down
6 changes: 0 additions & 6 deletions spec/presenters/document_presenter_spec.rb
Expand Up @@ -300,12 +300,6 @@ def mock_document_app_helper_url *args
expect(subject.render_field_value(['a', 'b'])).to eq "a and b"
end

it "should use the separator from the Blacklight field configuration by default" do
Deprecation.silence(Blacklight::DocumentPresenter) do
expect(subject.render_field_value(['c', 'd'], double(separator: '; ', itemprop: nil, separator_options: nil))).to eq "c; d"
end
end

it "should use the field_config.separator_options from the Blacklight field configuration" do
expect(subject.render_field_value(['c', 'd'], double(separator: nil, itemprop: nil, separator_options: { two_words_connector: '; '}))).to eq "c; d"
end
Expand Down

0 comments on commit d64f846

Please sign in to comment.