blacklight 4.5.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -2
  3. data/VERSION +1 -1
  4. data/app/assets/javascripts/blacklight/blacklight.js +1 -1
  5. data/app/helpers/blacklight/blacklight_helper_behavior.rb +13 -3
  6. data/app/helpers/blacklight/catalog_helper_behavior.rb +47 -6
  7. data/app/helpers/blacklight/facets_helper_behavior.rb +5 -1
  8. data/app/helpers/blacklight/html_head_helper_behavior.rb +28 -13
  9. data/app/views/catalog/_paginate_compact.html.erb +1 -1
  10. data/app/views/catalog/_search_header.html.erb +5 -0
  11. data/app/views/catalog/facet.html.erb +2 -0
  12. data/app/views/catalog/index.html.erb +2 -6
  13. data/app/views/catalog/show.html.erb +1 -1
  14. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -1
  15. data/app/views/layouts/blacklight.html.erb +2 -2
  16. data/blacklight.gemspec +3 -1
  17. data/config/locales/blacklight.en.yml +1 -1
  18. data/gemfiles/rails3.gemfile +1 -2
  19. data/gemfiles/rails4.gemfile +0 -1
  20. data/lib/blacklight.rb +1 -0
  21. data/lib/blacklight/catalog.rb +8 -3
  22. data/lib/blacklight/catalog/search_context.rb +13 -5
  23. data/lib/blacklight/legacy_controller_methods.rb +18 -4
  24. data/lib/blacklight/solr/document.rb +7 -1
  25. data/lib/blacklight/solr/document/marc_export.rb +12 -24
  26. data/lib/blacklight/solr_helper.rb +4 -1
  27. data/lib/blacklight/solr_response/pagination_methods.rb +6 -0
  28. data/lib/generators/blacklight/blacklight_generator.rb +0 -4
  29. data/lib/generators/blacklight/marc_generator.rb +2 -2
  30. data/spec/controllers/application_controller_spec.rb +8 -6
  31. data/spec/controllers/catalog_controller_spec.rb +4 -4
  32. data/spec/features/did_you_mean_spec.rb +3 -3
  33. data/spec/features/search_filters_spec.rb +1 -1
  34. data/spec/features/search_spec.rb +1 -1
  35. data/spec/helpers/blacklight_helper_spec.rb +7 -1
  36. data/spec/helpers/catalog_helper_spec.rb +37 -21
  37. data/spec/helpers/facets_helper_spec.rb +8 -7
  38. data/spec/helpers/html_head_helper_spec.rb +25 -8
  39. data/spec/lib/blacklight_solr_response_spec.rb +9 -0
  40. data/spec/lib/marc_export_spec.rb +1 -8
  41. data/spec/views/catalog/_search_header.erb_spec.rb +17 -0
  42. data/spec/views/catalog/_show_sidebar.erb_spec.rb +2 -2
  43. data/spec/views/catalog/index.html.erb_spec.rb +13 -0
  44. metadata +34 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d0587369df20fe60865e7e145ee2331b24bb10e
4
- data.tar.gz: 45af7e3cca647a11de41d7d87c5b9d29bfe84585
3
+ metadata.gz: 550e843bc936edf7872cd484e377e2b3b47fd095
4
+ data.tar.gz: bef46f39d076a8eea2b16e9e5e58ecd7b05bd714
5
5
  SHA512:
6
- metadata.gz: 6e3916a1be5e25e6d1455de5a76bdea0102fada96d69e1ccb182b8e674d45968f36509f25e2a163e6533d3ef3caa65474867aa91ece5de100eb54674b156ec4e
7
- data.tar.gz: db866f3d02c5a0e8b2a9a5c773c999308cb8f68fdd3cf79d366efecaefd2e41b279df6774ee5f5237a6097bf7ee122be82d5ab8b63f353012cd52e2bf4293b5b
6
+ metadata.gz: 10dc73791badec8cdbbb1fa1309d15863b979bfae3a26116496cc8f4ef03204ea62f3262b559e216053e916908c57c9aa82c1df1220a21e83912373b22cd876e
7
+ data.tar.gz: c1bee8205d70bdff994225c1e3d9341252191b482ec59edfbd1f5cde7f3927f7522a2d99bb362e2677c61355b6030eb09070e433a26193e7980f8e2fc6cde082
data/Gemfile CHANGED
@@ -12,9 +12,8 @@ group :test do
12
12
  gem "bootstrap-sass"
13
13
  gem 'turbolinks'
14
14
  gem 'poltergeist'
15
- gem "unicode", :platforms => [:mri_18, :mri_19]
16
15
  end
17
16
 
18
17
  if File.exists?('spec/test_app_templates/Gemfile.extra')
19
18
  eval File.read('spec/test_app_templates/Gemfile.extra'), nil, 'spec/test_app_templates/Gemfile.extra'
20
- end
19
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.5.0
1
+ 4.6.0
@@ -60,4 +60,4 @@
60
60
  };
61
61
  */
62
62
 
63
- $('.no-js').removeClass('no-js')
63
+ $('.no-js').removeClass('no-js').addClass('js');
@@ -4,6 +4,10 @@
4
4
  # Methods added to this helper will be available to all templates in the hosting application
5
5
  #
6
6
  module Blacklight::BlacklightHelperBehavior
7
+
8
+ extend Deprecation
9
+ self.deprecation_horizon = 'Blacklight 5.x'
10
+
7
11
  include HashAsHiddenFieldsHelper
8
12
  include RenderConstraintsHelper
9
13
  include HtmlHeadHelper
@@ -61,14 +65,15 @@ module Blacklight::BlacklightHelperBehavior
61
65
  # collection of items to be rendered in the @sidebar
62
66
  # @deprecated
63
67
  def sidebar_items
64
- ActiveSupport::Deprecation.warn("#sidebar_items helper is deprecated, and should be replaced by overriding the appropriate partial")
65
68
  @sidebar_items ||= []
66
69
  end
70
+ deprecation_deprecate :sidebar_items
67
71
 
68
72
  # collection of items to be rendered in the @topbar
69
73
  def topbar_items
70
74
  @topbar_items ||= []
71
75
  end
76
+ deprecation_deprecate :topbar_items
72
77
 
73
78
  def render_search_bar
74
79
  render :partial=>'catalog/search_form'
@@ -121,6 +126,7 @@ module Blacklight::BlacklightHelperBehavior
121
126
  # Field keys for the index fields
122
127
  # @deprecated
123
128
  def index_field_names document=nil
129
+ Deprecation.warn(self, "#index_field_names helper is deprecated, and should be replaced by overriding the appropriate partial")
124
130
  index_fields(document).keys
125
131
  end
126
132
 
@@ -129,6 +135,8 @@ module Blacklight::BlacklightHelperBehavior
129
135
  # @deprecated
130
136
  def index_field_labels document=nil
131
137
  # XXX DEPRECATED
138
+ Deprecation.warn(self, "#index_field_labels helper is deprecated, and should be replaced by overriding the appropriate partial")
139
+
132
140
  Hash[*index_fields(document).map { |key, field| [key, field.label] }.flatten]
133
141
  end
134
142
 
@@ -255,6 +263,8 @@ module Blacklight::BlacklightHelperBehavior
255
263
  # @deprecated
256
264
  def document_show_field_labels document=nil
257
265
  # XXX DEPRECATED
266
+ Deprecation.warn(self, "#document_show_field_labels helper is deprecated, and should be replaced by overriding the appropriate partial")
267
+
258
268
  Hash[*document_show_fields(document).map { |key, field| [key, field.label] }.flatten]
259
269
  end
260
270
 
@@ -609,8 +619,8 @@ module Blacklight::BlacklightHelperBehavior
609
619
  ##
610
620
  # Should we render a grouped response (because the response
611
621
  # contains a grouped response instead of the normal response)
612
- def render_grouped_response?
613
- return @response.grouped?
622
+ def render_grouped_response? response = @response
623
+ return response.grouped?
614
624
  end
615
625
 
616
626
  ##
@@ -1,6 +1,9 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Blacklight::CatalogHelperBehavior
3
3
 
4
+ extend Deprecation
5
+ self.deprecation_horizon = 'Blacklight 5.x'
6
+
4
7
  # Pass in an RSolr::Response (or duck-typed similar) object,
5
8
  # it translates to a Kaminari-paginatable
6
9
  # object, with the keys Kaminari views expect.
@@ -25,11 +28,7 @@ module Blacklight::CatalogHelperBehavior
25
28
  #
26
29
  # Pass in an RSolr::Response. Displays the "showing X through Y of N" message.
27
30
  def render_pagination_info(response, options = {})
28
- # TODO: i18n the entry_name
29
- entry_name = options[:entry_name]
30
- entry_name ||= response.docs.first.class.name.underscore.sub('_', ' ') unless response.docs.empty?
31
- entry_name ||= t('blacklight.entry_name.default')
32
-
31
+ entry_name = options[:entry_name] || t('blacklight.entry_name.default')
33
32
 
34
33
  end_num = if render_grouped_response?
35
34
  format_num(response.start + response.groups.length)
@@ -43,6 +42,48 @@ module Blacklight::CatalogHelperBehavior
43
42
  else; t('blacklight.search.pagination_info.pages', :entry_name => entry_name.pluralize, :current_page => response.current_page, :num_pages => response.total_pages, :start_num => format_num(response.start + 1) , :end_num => end_num, :total_num => response.total_count, :count => response.total_pages).html_safe
44
43
  end
45
44
  end
45
+ deprecation_deprecate :render_pagination_info
46
+
47
+ # Override the Kaminari page_entries_info helper with our own, blacklight-aware
48
+ # implementation
49
+ #
50
+ # Pass in an RSolr::Response. Displays the "showing X through Y of N" message.
51
+
52
+ def page_entries_info(collection, options = {})
53
+ entry_name = if options[:entry_name]
54
+ options[:entry_name]
55
+ elsif collection.respond_to? :model # DataMapper
56
+ collection.model.model_name.humanize.downcase
57
+ elsif collection.respond_to? :model_name and !collection.model_name.nil? # AR, Blacklight::PaginationMethods
58
+ collection.model_name.humanize.downcase
59
+ elsif collection.is_a?(::Kaminari::PaginatableArray)
60
+ 'entry'
61
+ else
62
+ t('blacklight.entry_name.default')
63
+ end
64
+
65
+ entry_name = entry_name.pluralize unless collection.total_count == 1
66
+
67
+ # grouped response objects need special handling
68
+ end_num = if collection.respond_to? :groups and render_grouped_response? collection
69
+ collection.groups.length
70
+ else
71
+ collection.limit_value
72
+ end
73
+
74
+ end_num = if collection.offset_value + end_num <= collection.total_count
75
+ format_num(collection.offset_value + end_num)
76
+ else
77
+ format_num(collection.total_count)
78
+ end
79
+
80
+ case collection.total_count
81
+ when 0; t('blacklight.search.pagination_info.no_items_found', :entry_name => entry_name ).html_safe
82
+ when 1; t('blacklight.search.pagination_info.single_item_found', :entry_name => entry_name).html_safe
83
+ else; t('blacklight.search.pagination_info.pages', :entry_name => entry_name, :current_page => collection.current_page, :num_pages => collection.total_pages, :start_num => format_num(collection.offset_value + 1) , :end_num => end_num, :total_num => collection.total_count, :count => collection.total_pages).html_safe
84
+ end
85
+ end
86
+
46
87
 
47
88
  def document_counter_with_offset idx
48
89
  unless render_grouped_response?
@@ -50,7 +91,7 @@ module Blacklight::CatalogHelperBehavior
50
91
  end
51
92
  end
52
93
 
53
- # Like #render_pagination_info above, but for an individual
94
+ # Like #page_entries_info above, but for an individual
54
95
  # item show page. Displays "showing X of Y items" message. Actually takes
55
96
  # data from session though (not a great design).
56
97
  # Code should call this method rather than interrogating session directly,
@@ -1,5 +1,9 @@
1
1
  module Blacklight::FacetsHelperBehavior
2
2
 
3
+ extend Deprecation
4
+ self.deprecation_horizon = 'Blacklight 5.x'
5
+
6
+
3
7
  include Blacklight::Facet
4
8
 
5
9
  # used in the catalog/_facets partial
@@ -31,7 +35,7 @@ module Blacklight::FacetsHelperBehavior
31
35
  #
32
36
  def render_facet_limit(display_facet, options = {})
33
37
  if display_facet.is_a? String or display_facet.is_a? Symbol
34
- $stderr.puts "DEPRECATION WARNING: Blacklight::FacetsHelper#render_facet_limit: use #render_facet_partials to render facets by field name"
38
+ Deprecation.warn(self, "Blacklight::FacetsHelper#render_facet_limit: use #render_facet_partials to render facets by field name")
35
39
  return render_facet_partials([display_facet])
36
40
  end
37
41
  return if not should_render_facet?(display_facet)
@@ -1,4 +1,7 @@
1
1
  module Blacklight::HtmlHeadHelperBehavior
2
+ extend Deprecation
3
+ self.deprecation_horizon = 'Blacklight 5.x'
4
+
2
5
  ##
3
6
  # This method should be included in any Blacklight layout, including
4
7
  # custom ones. It will output results of #render_js_includes,
@@ -59,12 +62,16 @@ module Blacklight::HtmlHeadHelperBehavior
59
62
  # stylesheet_links << ["stylesheet1.css", "stylesheet2.css", {:cache => "mykey"}]
60
63
  # javascript_includes << ["myjavascript.js", {:plugin => :myplugin} ]
61
64
  def render_head_content
62
- render_stylesheet_includes +
63
- render_js_includes +
64
- render_extra_head_content +
65
+ Deprecation.silence(Blacklight::HtmlHeadHelperBehavior) do
66
+ render_stylesheet_includes +
67
+ render_js_includes +
68
+ render_extra_head_content
69
+ end +
65
70
  content_for(:head)
66
71
  end
67
72
 
73
+ deprecation_deprecate :render_head_content
74
+
68
75
  ##
69
76
  # Assumes controller has a #stylesheet_link_tag method, array with
70
77
  # each element being a set of arguments for stylesheet_link_tag
@@ -72,11 +79,13 @@ module Blacklight::HtmlHeadHelperBehavior
72
79
  # adding stylesheets.
73
80
  def render_stylesheet_includes
74
81
  return "".html_safe unless respond_to?(:stylesheet_links)
75
-
76
- stylesheet_links.uniq.collect do |args|
77
- stylesheet_link_tag(*args)
78
- end.join("\n").html_safe
82
+ Deprecation.silence(Blacklight::LegacyControllerMethods) do
83
+ stylesheet_links.uniq.collect do |args|
84
+ stylesheet_link_tag(*args)
85
+ end.join("\n").html_safe
86
+ end
79
87
  end
88
+ deprecation_deprecate :render_stylesheet_includes
80
89
 
81
90
 
82
91
  ##
@@ -85,12 +94,15 @@ module Blacklight::HtmlHeadHelperBehavior
85
94
  # See #render_head_content for instructions on local code or plugins
86
95
  # adding js files.
87
96
  def render_js_includes
88
- return "".html_safe unless respond_to?(:javascript_includes)
89
-
90
- javascript_includes.uniq.collect do |args|
91
- javascript_include_tag(*args)
92
- end.join("\n").html_safe
97
+ return "".html_safe unless respond_to?(:javascript_includes)
98
+
99
+ Deprecation.silence(Blacklight::LegacyControllerMethods) do
100
+ javascript_includes.uniq.collect do |args|
101
+ javascript_include_tag(*args)
102
+ end.join("\n").html_safe
103
+ end
93
104
  end
105
+ deprecation_deprecate :render_js_includes
94
106
 
95
107
  ##
96
108
  # Assumes controller has a #extra_head_content method
@@ -98,6 +110,9 @@ module Blacklight::HtmlHeadHelperBehavior
98
110
  def render_extra_head_content
99
111
  return "".html_safe unless respond_to?(:extra_head_content)
100
112
 
101
- extra_head_content.join("\n").html_safe
113
+ Deprecation.silence(Blacklight::LegacyControllerMethods) do
114
+ extra_head_content.join("\n").html_safe
115
+ end
102
116
  end
117
+ deprecation_deprecate :render_extra_head_content
103
118
  end
@@ -1,5 +1,5 @@
1
1
  <% if @response.total_pages > 1 %>
2
2
  <%= paginate @response, :theme => :blacklight_compact %>
3
3
  <% else %>
4
- <%= render_pagination_info(@response) %>
4
+ <%= page_entries_info(@response) %>
5
5
  <% end %>
@@ -0,0 +1,5 @@
1
+ <%= render 'did_you_mean' %>
2
+
3
+ <%= render 'constraints' %>
4
+
5
+ <%= render 'sort_and_per_page' %>
@@ -1,6 +1,8 @@
1
+ <% Deprecation.silence(Blacklight::BlacklightHelperBehavior) do -%>
1
2
  <% sidebar_items << capture do %>
2
3
  <p><%= link_back_to_catalog %></p>
3
4
  <% end %>
5
+ <% end %>
4
6
 
5
7
  <div class="facet_pagination top">
6
8
  <%= render :partial=>'facet_pagination' %>
@@ -14,13 +14,9 @@
14
14
  <% @page_title = t('blacklight.search.title', :application_name => application_name) %>
15
15
 
16
16
 
17
- <% extra_head_content << render_opensearch_response_metadata.html_safe %>
17
+ <% Deprecation.silence(Blacklight::LegacyControllerMethods) { extra_head_content << render_opensearch_response_metadata.html_safe } %>
18
18
 
19
- <%= render 'did_you_mean' %>
20
-
21
- <%= render 'constraints' %>
22
-
23
- <%= render 'sort_and_per_page' %>
19
+ <%= render 'search_header' %>
24
20
 
25
21
  <h2 class="hide-text"><%= t('blacklight.search.search_results') %></h2>
26
22
 
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
  <% @page_title = t('blacklight.search.show.title', :document_title => document_show_html_title, :application_name => application_name) %>
7
- <% extra_head_content << render_link_rel_alternates %>
7
+ <% Deprecation.silence(Blacklight::LegacyControllerMethods) { extra_head_content << render_link_rel_alternates } %>
8
8
 
9
9
  <%# this should be in a partial -%>
10
10
  <div id="document" class="<%= render_document_class %>">
@@ -8,7 +8,7 @@
8
8
 
9
9
  Paginator now using the Bootstrap paginator class
10
10
  -%>
11
- <%- pagination_info_cache = render_pagination_info @response %>
11
+ <%- pagination_info_cache = page_entries_info @response %>
12
12
 
13
13
  <%= paginator.render do -%>
14
14
  <%= prev_page_tag %> | <%= pagination_info_cache %> | <%= next_page_tag %>
@@ -19,7 +19,7 @@
19
19
  <%= stylesheet_link_tag "application" %>
20
20
  <%= javascript_include_tag "application" %>
21
21
  <%= csrf_meta_tags %>
22
- <%= raw(render_head_content) %>
22
+ <%= Deprecation.silence(Blacklight::HtmlHeadHelperBehavior) { raw(render_head_content) } %>
23
23
 
24
24
  <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
25
25
  <!--[if lt IE 9]>
@@ -36,7 +36,7 @@
36
36
  <div id="main-container" class="container">
37
37
  <!-- Top bar -->
38
38
  <div id="search-found" class="row hidden-phone">
39
- <%= topbar_items.join('').html_safe %>
39
+ <%= Deprecation.silence(Blacklight::BlacklightHelperBehavior) { topbar_items.join('').html_safe } %>
40
40
  </div>
41
41
  <!-- /Top bar -->
42
42
  <div class="row">
data/blacklight.gemspec CHANGED
@@ -27,9 +27,11 @@ Gem::Specification.new do |s|
27
27
  s.add_dependency "marc", ">= 0.4.3", "< 1.1" # Marc record parser.
28
28
  s.add_dependency "rsolr", "~> 1.0.6" # Library for interacting with rSolr.
29
29
  s.add_dependency "kaminari", "~> 0.13" # the pagination (page 1,2,3, etc..) of our search results
30
- s.add_dependency "sass-rails"
30
+ s.add_dependency "sass-rails"
31
31
  s.add_dependency "bootstrap-sass", ">= 2.2.0", "< 2.4"
32
+ s.add_dependency "deprecation"
32
33
  s.add_development_dependency "jettywrapper", ">= 1.4.1"
33
34
  s.add_development_dependency "rspec-rails"
34
35
  s.add_development_dependency 'engine_cart', ">= 0.1.0"
36
+ s.add_development_dependency "equivalent-xml"
35
37
  end
@@ -186,7 +186,7 @@ en:
186
186
  title: 'Results navigation'
187
187
  pagination_info:
188
188
  no_items_found: 'No %{entry_name} found'
189
- single_item_found: '<strong>1</strong> to <strong>1</strong> of <strong>1</strong>'
189
+ single_item_found: '<strong>1</strong> %{entry_name} found'
190
190
  pages:
191
191
  one: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> of <strong>%{total_num}</strong>'
192
192
  other: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> of <strong>%{total_num}</strong>'
@@ -17,10 +17,9 @@ group :test do
17
17
  gem 'turbolinks'
18
18
  gem 'uglifier'
19
19
  gem 'poltergeist'
20
- gem "unicode", :platforms => [:mri_18, :mri_19]
21
20
  end
22
21
 
23
22
  f = File.expand_path(File.dirname(__FILE__) + '/../spec/test_app_templates/Gemfile.extra')
24
23
  if File.exists?(f)
25
24
  eval File.read(f), nil, f
26
- end
25
+ end
@@ -16,7 +16,6 @@ group :test do
16
16
  gem "bootstrap-sass"
17
17
  gem 'turbolinks'
18
18
  gem 'poltergeist'
19
- gem "unicode", :platforms => [:mri_18, :mri_19]
20
19
  end
21
20
 
22
21
  f = File.expand_path(File.dirname(__FILE__) + '/../spec/test_app_templates/Gemfile.extra')
data/lib/blacklight.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'kaminari'
3
3
  require 'rsolr'
4
+ require 'deprecation'
4
5
 
5
6
  module Blacklight
6
7
 
@@ -1,5 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Blacklight::Catalog
3
+ extend Deprecation
4
+ self.deprecation_horizon = 'Blacklight 5.x'
5
+
3
6
  extend ActiveSupport::Concern
4
7
 
5
8
  include Blacklight::Base
@@ -28,8 +31,10 @@ module Blacklight::Catalog
28
31
 
29
32
  respond_to do |format|
30
33
  format.html {
31
- extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss')), :title => t('blacklight.search.rss_feed') )
32
- extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom')), :title => t('blacklight.search.atom_feed') )
34
+ Deprecation.silence(Blacklight::LegacyControllerMethods) do
35
+ extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss')), :title => t('blacklight.search.rss_feed') )
36
+ extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom')), :title => t('blacklight.search.atom_feed') )
37
+ end
33
38
  }
34
39
  format.rss { render :layout => false }
35
40
  format.atom { render :layout => false }
@@ -201,7 +206,7 @@ module Blacklight::Catalog
201
206
  # include certain partials or not
202
207
  def adjust_for_results_view
203
208
  # deprecated in blacklight 4.x
204
- ActiveSupport::Deprecation.warn("#adjust_for_results_view helper was deprecated in Blacklight 4.x")
209
+ Deprecation.warn(self, "#adjust_for_results_view helper was deprecated in Blacklight 4.x")
205
210
  end
206
211
 
207
212
  # extract the pagination info from the response object
@@ -30,11 +30,19 @@ module Blacklight::Catalog::SearchContext
30
30
  find_or_initialize_search_session_from_params params
31
31
  elsif params[:search_context] and !params[:search_context].blank?
32
32
  find_or_initialize_search_session_from_params JSON.load(params[:search_context])
33
- elsif params[:search_id] and !params[:search_id].blank?
34
- # TODO : check the search id signature.
35
- searches_from_history.find(params[:search_id]) rescue nil
33
+ elsif params[:search_id].present?
34
+ begin
35
+ # TODO : check the search id signature.
36
+ searches_from_history.find(params[:search_id])
37
+ rescue ActiveRecord::RecordNotFound
38
+ nil
39
+ end
36
40
  elsif search_session[:id]
37
- searches_from_history.find(search_session[:id]) rescue nil
41
+ begin
42
+ searches_from_history.find(search_session[:id])
43
+ rescue ActiveRecord::RecordNotFound
44
+ nil
45
+ end
38
46
  end
39
47
 
40
48
  if @current_search_session
@@ -121,4 +129,4 @@ module Blacklight::Catalog::SearchContext
121
129
  ActiveSupport::Deprecation.warn("#set_additional_search_session_values helper was deprecated in Blacklight 4.x")
122
130
  end
123
131
 
124
- end
132
+ end