Skip to content

Commit

Permalink
Merge pull request #752 from projectblacklight/4x-deprecation
Browse files Browse the repository at this point in the history
Deprecation warnings for features removed in #751
  • Loading branch information
jcoyne committed Feb 5, 2014
2 parents 1742da4 + cda9ec4 commit 1bd9181
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/helpers/blacklight/blacklight_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def extra_body_classes
def render_document_list_partial options={}
render :partial=>'catalog/document_list'
end
deprecation_deprecate :render_document_list_partial

# Save function area for search results 'index' view, normally
# renders next to title.
Expand All @@ -103,6 +104,10 @@ def render_index_doc_actions(document, options={})
def render_show_doc_actions(document=@document, options={})
# I'm not sure why this key is documentFunctions and #render_index_doc_actions uses wrapping_class.
# TODO: remove documentFunctions key in Blacklight 5.x
if options.has_key? :documentFunctions
Deprecation.warn(Blacklight::BlacklightHelperBehavior, "Calling #render_show_doc_actions with the :documentFunctions option is deprecated; use :wrapping_class instead")
end

wrapping_class = options.delete(:documentFunctions) || options.delete(:wrapping_class) || "documentFunctions"

content = []
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/blacklight/render_constraints_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def render_filter_element(facet, values, localized_params)
# [:escape_value]
# default true, HTML escape.
def render_constraint_element(label, value, options = {})
if (options[:escape_label] and !label.html_safe?) or (options.has_key?(:escape_value) and !value.html_safe?)
Deprecation.warn(Blacklight::RenderConstraintsHelperBehavior, "Calling #render_constraint_element with :escape_label or :escape_value parameters is deprecated; make sure your values are #html_safe instead")
end

render(:partial => "catalog/constraints_element", :locals => {:label => label, :value => value, :options => options})
end

Expand Down
7 changes: 7 additions & 0 deletions lib/railties/blacklight.rake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ namespace :blacklight do
Search.delete_old_searches(args[:days_old].to_i)
end

namespace :solr do
desc "Put sample data into solr"
task :seed do
Rake::Task["solr:marc:index_test_data"].invoke
end
end

end


10 changes: 9 additions & 1 deletion spec/helpers/blacklight_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def blacklight_config
def current_search_session

end

describe "deprecated methods" do
describe "#index_field_names" do
it "should warn" do
Expand All @@ -113,6 +113,14 @@ def current_search_session
helper.document_show_field_labels
end
end

describe "#render_document_list_partial" do
it "should warn" do
expect(Blacklight::BlacklightHelperBehavior.deprecation_behavior.first).to receive(:call)
helper.stub(:render)
helper.render_document_list_partial
end
end
end

describe "#application_name", :test => true do
Expand Down

0 comments on commit 1bd9181

Please sign in to comment.