blacklight 6.9.0 → 6.10.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2061ccbc1e4df9ec4a7c1b1f780ea5420a379483
4
- data.tar.gz: f08c9eac999b9954471352a6d5c1d83f9885a932
3
+ metadata.gz: 60df91a78d3181795975d6b62bb92482e1b05151
4
+ data.tar.gz: 6c20566992ac377318609c742c12a5786db2f3db
5
5
  SHA512:
6
- metadata.gz: 8708c94876e422d943c9fdada3c5faefa71342a7112e6e2a8ce32b7a82b56be6b18ed74f041773e75594928e69fd30067c74ba65bfd7df1be5190f484113a643
7
- data.tar.gz: 7ae034c2608744da8b713df542509e87e27380794c2400ef3b90bb829e262fc21895fdb7650b133c89d87b8270987b6afd9804408753be1ad4695c886800703f
6
+ metadata.gz: 6f8b43752993d04d66797cb247c542a3f1ec5b881a6f869ea6ad557cdf329c74039de7e9d7cd10a5664d12d2c88524df86c82a9e2cb324dce0973c6aea914fd2
7
+ data.tar.gz: 26aa1ebc30886fcda720c4df6b00b728d8cd7a186887c6eda806de0c3680f18956438c795d2a67b17d7868ce30e51f12394abe0e12f96cc0ff4cede008984b7a
data/.rubocop_todo.yml CHANGED
@@ -90,6 +90,8 @@ Metrics/BlockNesting:
90
90
  # Configuration parameters: CountComments.
91
91
  Metrics/ClassLength:
92
92
  Max: 186
93
+ Exclude:
94
+ - 'lib/blacklight/configuration.rb'
93
95
 
94
96
  # Offense count: 20
95
97
  Metrics/CyclomaticComplexity:
@@ -99,11 +101,15 @@ Metrics/CyclomaticComplexity:
99
101
  # Configuration parameters: CountComments.
100
102
  Metrics/MethodLength:
101
103
  Max: 52
104
+ Exclude:
105
+ - 'lib/blacklight/configuration.rb'
102
106
 
103
107
  # Offense count: 9
104
108
  # Configuration parameters: CountComments.
105
109
  Metrics/ModuleLength:
106
110
  Max: 208
111
+ Exclude:
112
+ - 'lib/blacklight/solr/search_builder_behavior.rb'
107
113
 
108
114
  # Offense count: 1
109
115
  # Configuration parameters: CountKeywordArgs.
data/.travis.yml CHANGED
@@ -5,16 +5,16 @@ notifications:
5
5
  email: false
6
6
 
7
7
  rvm:
8
- - 2.3.1
8
+ - 2.4.1
9
9
 
10
10
  matrix:
11
11
  include:
12
- - rvm: 2.3.3
13
- env: "RAILS_VERSION=4.2.8"
14
- - rvm: 2.2.6
15
- env: "RAILS_VERSION=5.0.2"
12
+ - rvm: 2.2.7
13
+ env: "RAILS_VERSION=5.0.3"
14
+ - rvm: 2.3.4
15
+ env: "RAILS_VERSION=5.1.1"
16
16
  - rvm: jruby-9.1.7.0
17
- env: "RAILS_VERSION=5.0.2 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
17
+ env: "RAILS_VERSION=5.0.3 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
18
18
  allow_failures:
19
19
  - rvm: jruby-9.1.7.0
20
20
  fast_finish: true
@@ -24,7 +24,7 @@ before_install:
24
24
  - gem install bundler
25
25
 
26
26
  env:
27
- - "RAILS_VERSION=5.0.2"
27
+ - "RAILS_VERSION=5.1.1"
28
28
 
29
29
  notifications:
30
30
  irc: "irc.freenode.org#blacklight"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.9.0
1
+ 6.10.0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- class CreateSearches < ActiveRecord::Migration
2
+ class CreateSearches < ActiveRecord::Migration[4.2]
3
3
  def self.up
4
4
  create_table :searches do |t|
5
5
  t.binary :query_params
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- class CreateBookmarks < ActiveRecord::Migration
2
+ class CreateBookmarks < ActiveRecord::Migration[4.2]
3
3
  def self.up
4
4
  create_table :bookmarks do |t|
5
5
  t.integer :user_id, index: true, null: false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- class AddPolymorphicTypeToBookmarks < ActiveRecord::Migration
2
+ class AddPolymorphicTypeToBookmarks < ActiveRecord::Migration[4.2]
3
3
  def change
4
4
  add_column(:bookmarks, :document_type, :string) unless Bookmark.connection.column_exists? :bookmarks, :document_type
5
5
 
@@ -136,7 +136,8 @@ module Blacklight
136
136
  default_per_page: nil,
137
137
  # how many searches to save in session history
138
138
  search_history_window: 100,
139
- default_facet_limit: 10
139
+ default_facet_limit: 10,
140
+ default_more_limit: 20
140
141
  }
141
142
  end
142
143
  end
@@ -185,11 +185,13 @@ module Blacklight::Solr
185
185
  solr_params[:"facet.field"] = with_ex_local_param(facet_ex, facet_config.field)
186
186
 
187
187
  limit = if scope.respond_to?(:facet_list_limit)
188
+ Deprecation.warn(self, "The use of facet_list_limit is deprecated and will be removed in 7.0. " \
189
+ "Consider using the 'more_limit' option in the field configuration or 'default_more_limit' instead.")
188
190
  scope.facet_list_limit.to_s.to_i
189
191
  elsif solr_params["facet.limit"]
190
192
  solr_params["facet.limit"].to_i
191
193
  else
192
- facet_config.fetch(:more_limit, 20)
194
+ facet_config.fetch(:more_limit, blacklight_config.default_more_limit)
193
195
  end
194
196
 
195
197
  page = blacklight_params.fetch(request_keys[:page], 1).to_i
@@ -8,23 +8,34 @@ module Blacklight
8
8
 
9
9
  return if has_blacklight_assets?
10
10
 
11
+ contents = "\n//\n// Required by Blacklight\n"
12
+ contents += "//= require jquery\n" if rails_5_1?
13
+ contents += "//= require blacklight/blacklight\n"
14
+
11
15
  marker = if turbolinks?
12
16
  '//= require turbolinks'
17
+ elsif rails_5_1?
18
+ '//= require rails-ujs'
13
19
  else
14
20
  '//= require jquery_ujs'
15
21
  end
16
22
 
17
23
  insert_into_file "app/assets/javascripts/application.js", :after => marker do
18
- <<-EOF
19
- //
20
- // Required by Blacklight
21
- //= require blacklight/blacklight
22
- EOF
24
+ contents
23
25
  end
24
26
  end
25
27
 
28
+ # This is not a default in Rails 5.1
29
+ def add_jquery
30
+ gem 'jquery-rails' if rails_5_1?
31
+ end
32
+
26
33
  private
27
34
 
35
+ def rails_5_1?
36
+ Rails.version =~ /5\.1/
37
+ end
38
+
28
39
  def turbolinks?
29
40
  @turbolinks ||= IO.read("app/assets/javascripts/application.js").include?('turbolinks')
30
41
  end
@@ -5,7 +5,7 @@ class AlternateController < CatalogController
5
5
  end
6
6
 
7
7
  def xyz *args
8
- view_context.image_tag "asdfg"
8
+ view_context.tag "img"
9
9
  end
10
10
 
11
11
  helper_method :xyz
@@ -20,7 +20,7 @@ module Blacklight
20
20
  return unless options[:devise]
21
21
 
22
22
  gem "devise"
23
- gem "devise-guests", "~> 0.5"
23
+ gem "devise-guests", "~> 0.6"
24
24
 
25
25
  Bundler.with_clean_env do
26
26
  run "bundle install"
@@ -131,15 +131,19 @@ describe CatalogHelper do
131
131
 
132
132
  describe "rss_feed_link_tag" do
133
133
  context "when an alternate scope is passed in" do
134
+ subject(:tag) { helper.rss_feed_link_tag(route_set: my_engine) }
135
+
134
136
  let(:my_engine) { double("Engine") }
135
137
  let(:query_params) { { controller: 'catalog', action: 'index' } }
136
138
  let(:config) { Blacklight::Configuration.new }
137
139
  let(:search_state) { Blacklight::SearchState.new(query_params, config, controller) }
138
140
 
139
- it "calls url_for on the engine scope" do
141
+ before do
140
142
  allow(helper).to receive(:search_state).and_return search_state
141
- expect(my_engine).to receive(:url_for).and_return(url_for(query_params))
142
- tag = helper.rss_feed_link_tag(route_set: my_engine)
143
+ end
144
+
145
+ it "calls url_for on the engine scope" do
146
+ expect(my_engine).to receive(:url_for).and_return('/rss-path')
143
147
  expect(tag).to match /title="RSS for results"/
144
148
  expect(tag).to match /rel="alternate"/
145
149
  expect(tag).to match %r{type="application/rss\+xml"}
@@ -149,15 +153,19 @@ describe CatalogHelper do
149
153
 
150
154
  describe "atom_feed_link_tag" do
151
155
  context "when an alternate scope is passed in" do
156
+ subject(:tag) { helper.atom_feed_link_tag(route_set: my_engine) }
157
+
152
158
  let(:my_engine) { double("Engine") }
153
159
  let(:query_params) { { controller: 'catalog', action: 'index' } }
154
160
  let(:config) { Blacklight::Configuration.new }
155
161
  let(:search_state) { Blacklight::SearchState.new(query_params, config, controller) }
156
162
 
157
- it "calls url_for on the engine scope" do
163
+ before do
158
164
  allow(helper).to receive(:search_state).and_return search_state
159
- expect(my_engine).to receive(:url_for).and_return(url_for(query_params))
160
- tag = helper.atom_feed_link_tag(route_set: my_engine)
165
+ end
166
+
167
+ it "calls url_for on the engine scope" do
168
+ expect(my_engine).to receive(:url_for).and_return('/atom-path')
161
169
  expect(tag).to match /title="Atom for results"/
162
170
  expect(tag).to match /rel="alternate"/
163
171
  expect(tag).to match %r{type="application/atom\+xml"}
@@ -127,14 +127,18 @@ describe BlacklightUrlHelper do
127
127
 
128
128
  context "when an alternate scope is passed in" do
129
129
  let(:my_engine) { double("Engine") }
130
+ subject(:tag) { helper.link_back_to_catalog(route_set: my_engine) }
130
131
 
131
- it "calls url_for on the engine scope" do
132
+ before do
132
133
  allow(helper).to receive(:current_search_session).and_return double(:query_params => query_params)
133
- expect(my_engine).to receive(:url_for).and_return(url_for(query_params))
134
- tag = helper.link_back_to_catalog(route_set: my_engine)
134
+ end
135
+
136
+ it "calls url_for on the engine scope" do
137
+ expect(my_engine).to receive(:url_for)
138
+ .with(q:"query", f: "facets", controller: "catalog")
139
+ .and_return('link-url')
135
140
  expect(tag).to match /Back to Search/
136
- expect(tag).to match /q=query/
137
- expect(tag).to match /f=facets/
141
+ expect(tag).to match /link-url/
138
142
  end
139
143
  end
140
144
  end
@@ -367,7 +367,7 @@ describe Blacklight::Solr::SearchBuilderBehavior do
367
367
  end
368
368
  end
369
369
 
370
-
370
+
371
371
  describe "#facet_value_to_fq_string" do
372
372
  it "should use the configured field name" do
373
373
  blacklight_config.add_facet_field :facet_key, field: "facet_name"
@@ -480,7 +480,7 @@ describe Blacklight::Solr::SearchBuilderBehavior do
480
480
 
481
481
  let(:solr_parameters) do
482
482
  solr_parameters = Blacklight::Solr::Request.new
483
-
483
+
484
484
  subject.add_facetting_to_solr(solr_parameters)
485
485
 
486
486
  solr_parameters
@@ -512,7 +512,7 @@ describe Blacklight::Solr::SearchBuilderBehavior do
512
512
  it "should respect the include_in_request parameter" do
513
513
  blacklight_config.add_facet_field 'yes_facet', include_in_request: true
514
514
  blacklight_config.add_facet_field 'no_facet', include_in_request: false
515
-
515
+
516
516
  expect(solr_parameters[:'facet.field']).to include('yes_facet')
517
517
  expect(solr_parameters[:'facet.field']).not_to include('no_facet')
518
518
  end
@@ -640,6 +640,7 @@ describe Blacklight::Solr::SearchBuilderBehavior do
640
640
 
641
641
  context 'when facet_list_limit is defined in scope' do
642
642
  before do
643
+ allow(Deprecation).to receive(:warn)
643
644
  allow(context).to receive_messages facet_list_limit: 1000
644
645
  end
645
646
  it 'uses scope method for limit' do
@@ -1,4 +1,4 @@
1
- if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^5\.0/ || ENV['RAILS_VERSION'] == 'edge'
1
+ if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^5\./ || ENV['RAILS_VERSION'] == 'edge'
2
2
  gem 'rails-controller-testing'
3
3
  gem 'deprecation'
4
4
  end
@@ -6,7 +6,7 @@ describe "catalog/_facets" do
6
6
  before do
7
7
  allow(view).to receive_messages(blacklight_config: blacklight_config)
8
8
  allow(view).to receive(:search_action_path) do |*args|
9
- search_catalog_url *args
9
+ '/catalog'
10
10
  end
11
11
  end
12
12
 
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.9.0
4
+ version: 6.10.0
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-02 00:00:00.000000000 Z
20
+ date: 2017-05-17 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails