blacklight 6.10.0 → 6.10.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60df91a78d3181795975d6b62bb92482e1b05151
4
- data.tar.gz: 6c20566992ac377318609c742c12a5786db2f3db
3
+ metadata.gz: 13a1d0a576ef05724c0d14346328fd7650055bde
4
+ data.tar.gz: 5698a8f2653b6dca110bc5d7367000bc42c61e96
5
5
  SHA512:
6
- metadata.gz: 6f8b43752993d04d66797cb247c542a3f1ec5b881a6f869ea6ad557cdf329c74039de7e9d7cd10a5664d12d2c88524df86c82a9e2cb324dce0973c6aea914fd2
7
- data.tar.gz: 26aa1ebc30886fcda720c4df6b00b728d8cd7a186887c6eda806de0c3680f18956438c795d2a67b17d7868ce30e51f12394abe0e12f96cc0ff4cede008984b7a
6
+ metadata.gz: 9ab3959efcc3a80dc1058ca760252c99f831199aace9019136d34691f5d92d6af4f8d9199657713ef945f149b91341d8845a15716043b8ad2c0e272e3ae15f09
7
+ data.tar.gz: 155d327f094f45c424f98c56466606af7057db4b814fe62fb5f5b1ad7da0ce584447e6278d99f66b116f68e29c894559c3e10dafc4994a0a99561d3d19185c4a
data/.travis.yml CHANGED
@@ -9,6 +9,8 @@ rvm:
9
9
 
10
10
  matrix:
11
11
  include:
12
+ - rvm: 2.4.1
13
+ env: "RAILS_VERSION=4.2.8"
12
14
  - rvm: 2.2.7
13
15
  env: "RAILS_VERSION=5.0.3"
14
16
  - rvm: 2.3.4
@@ -23,6 +25,9 @@ before_install:
23
25
  - gem update --system
24
26
  - gem install bundler
25
27
 
28
+ before_script:
29
+ - if [[ "${RAILS_VERSION}" =~ ^4.2.* ]]; then perl -pi -e "s/ActiveRecord::Migration\[[\d\.]+\]/ActiveRecord::Migration/" db/migrate/*; fi
30
+
26
31
  env:
27
32
  - "RAILS_VERSION=5.1.1"
28
33
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.10.0
1
+ 6.10.1
@@ -96,7 +96,7 @@ module Blacklight::SearchContext
96
96
  def setup_next_and_previous_documents
97
97
  if search_session['counter'] and current_search_session
98
98
  index = search_session['counter'].to_i - 1
99
- response, documents = get_previous_and_next_documents_for_search index, ActiveSupport::HashWithIndifferentAccess.new(current_search_session.query_params)
99
+ response, documents = get_previous_and_next_documents_for_search index, search_state.reset(current_search_session.query_params).to_hash
100
100
 
101
101
  search_session['total'] = response.total
102
102
  @search_context_response = response
@@ -114,7 +114,7 @@ module Blacklight::UrlHelperBehavior
114
114
  # link_back_to_catalog(label: 'Back to Search', route_set: my_engine)
115
115
  def link_back_to_catalog(opts={:label=>nil})
116
116
  scope = opts.delete(:route_set) || self
117
- query_params = current_search_session.try(:query_params) || ActionController::Parameters.new
117
+ query_params = search_state.reset(current_search_session.try(:query_params)).to_hash
118
118
 
119
119
  if search_session['counter']
120
120
  per_page = (search_session['per_page'] || default_per_page).to_i
@@ -10,7 +10,7 @@
10
10
  <table class="table table-striped search_history">
11
11
  <%- @searches.each_with_index do |search,index| -%>
12
12
  <%= content_tag :tr, :id => "document_#{index + 1}" do %>
13
- <td class="query"><%= link_to_previous_search(search.query_params) %></td>
13
+ <td class="query"><%= link_to_previous_search(search_state.reset(search.query_params).to_hash) %></td>
14
14
  <%- if has_user_authentication_provider? -%>
15
15
  <td class="actions">
16
16
  <%- if current_or_guest_user && search.saved? -%>
@@ -37,8 +37,8 @@ module Blacklight
37
37
  end
38
38
  alias to_h to_hash
39
39
 
40
- def reset
41
- self.class.new(ActionController::Parameters.new, blacklight_config, controller)
40
+ def reset(params = nil)
41
+ self.class.new(params || ActionController::Parameters.new, blacklight_config, controller)
42
42
  end
43
43
 
44
44
  ##
@@ -32,6 +32,13 @@ class Blacklight::Solr::Response::GroupResponse
32
32
  params[:start].to_s.to_i
33
33
  end
34
34
 
35
+ ##
36
+ # Relying on a fallback (method missing) to @response is problematic as it
37
+ # will not evaluate the correct `total` method.
38
+ def empty?
39
+ total.zero?
40
+ end
41
+
35
42
  def method_missing meth, *args, &block
36
43
  if response.respond_to? meth
37
44
  response.send(meth, *args, &block)
@@ -8,9 +8,9 @@ describe Blacklight::SearchState do
8
8
  end
9
9
  end
10
10
 
11
+ subject(:search_state) { described_class.new(params, blacklight_config, controller) }
11
12
  let(:parameter_class) { ActionController::Parameters }
12
13
  let(:controller) { double }
13
- let(:search_state) { described_class.new(params, blacklight_config, controller) }
14
14
  let(:params) { parameter_class.new }
15
15
 
16
16
  describe '#to_h' do
@@ -297,4 +297,12 @@ describe Blacklight::SearchState do
297
297
  expect(params).not_to have_key :f
298
298
  end
299
299
  end
300
+
301
+ describe '#reset' do
302
+ it 'returns a search state with the given parameters' do
303
+ new_state = search_state.reset('a' => 1)
304
+
305
+ expect(new_state.to_hash).to eq({ 'a' => 1 })
306
+ end
307
+ end
300
308
  end
@@ -59,6 +59,12 @@ describe Blacklight::Solr::Response::GroupResponse do
59
59
  expect(group.group_limit).to eq 5
60
60
  end
61
61
  end
62
+
63
+ describe "empty?" do
64
+ it "uses the total from this object" do
65
+ expect(group.empty?).to be false
66
+ end
67
+ end
62
68
  end
63
69
 
64
70
  def create_response(response, params = {})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.10.0
4
+ version: 6.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: exe
19
19
  cert_chain: []
20
- date: 2017-05-17 00:00:00.000000000 Z
20
+ date: 2017-06-21 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails