blacklight 6.14.1 → 6.15.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 +4 -4
- data/.travis.yml +12 -10
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/checkbox_submit.js +1 -1
- data/app/assets/javascripts/blacklight/core.js +14 -23
- data/app/controllers/concerns/blacklight/catalog.rb +1 -1
- data/app/controllers/concerns/blacklight/token_based_user.rb +16 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +3 -1
- data/app/helpers/blacklight/component_helper_behavior.rb +2 -0
- data/app/models/concerns/blacklight/document/active_model_shim.rb +5 -0
- data/app/views/catalog/_facet_layout.html.erb +1 -1
- data/lib/blacklight/configuration.rb +1 -1
- data/lib/generators/blacklight/assets_generator.rb +5 -5
- data/spec/features/facets_spec.rb +13 -1
- data/spec/helpers/blacklight_helper_spec.rb +5 -1
- data/spec/test_app_templates/Gemfile.extra +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06d38d95ca2b94c85c6bfe14077f338c8fa276f8
|
4
|
+
data.tar.gz: f35d49bcdf90238709a06a7f16dfa898dd38a761
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3562e9f56ffb61d1c5995f9312f138384b5f47d7d0ce150fcbcf348fe91e3cd3fc9584f021e3e21e53728da1bf97d10408f5b5f4346bc213c6a9b274607d959c
|
7
|
+
data.tar.gz: 1584a23ffb76aabe4b21a6260be9fafe46dadeae7fd96834c79ad2c223b2714073d69b838acce7af65fc58955b585e80828efd3db702523d5635dcafecf6a93b
|
data/.travis.yml
CHANGED
@@ -5,20 +5,22 @@ notifications:
|
|
5
5
|
email: false
|
6
6
|
|
7
7
|
rvm:
|
8
|
-
- 2.
|
8
|
+
- 2.5.0
|
9
9
|
|
10
10
|
matrix:
|
11
11
|
include:
|
12
|
-
- rvm: 2.
|
13
|
-
env: "RAILS_VERSION=
|
14
|
-
- rvm: 2.
|
15
|
-
env: "RAILS_VERSION=
|
16
|
-
- rvm: 2.
|
17
|
-
env: "
|
18
|
-
- rvm:
|
19
|
-
env: "RAILS_VERSION=5.
|
12
|
+
- rvm: 2.5.0
|
13
|
+
env: "RAILS_VERSION=5.2.0"
|
14
|
+
- rvm: 2.4.4
|
15
|
+
env: "RAILS_VERSION=4.2.10"
|
16
|
+
- rvm: 2.2.10
|
17
|
+
env: "RAILS_VESION=5.0.7"
|
18
|
+
- rvm: 2.3.7
|
19
|
+
env: "RAILS_VERSION=5.1.6"
|
20
|
+
- rvm: jruby-9.1.17.0
|
21
|
+
env: "RAILS_VERSION=5.2.0 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
|
20
22
|
allow_failures:
|
21
|
-
- rvm: jruby-9.1.
|
23
|
+
- rvm: jruby-9.1.17.0
|
22
24
|
fast_finish: true
|
23
25
|
|
24
26
|
before_install:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
6.
|
1
|
+
6.15.0
|
@@ -49,7 +49,7 @@
|
|
49
49
|
var unique_id = form.attr("data-doc-id") || Math.random();
|
50
50
|
// if form is currently using method delete to change state,
|
51
51
|
// then checkbox is currently checked
|
52
|
-
var checked = (form.find("input[name=_method][value=delete]").
|
52
|
+
var checked = (form.find("input[name=_method][value=delete]").length != 0);
|
53
53
|
|
54
54
|
var checkbox = $('<input type="checkbox">')
|
55
55
|
.addClass( options.css_class )
|
@@ -9,31 +9,22 @@ Blacklight = function() {
|
|
9
9
|
for(var i = 0; i < buffer.length; i++) {
|
10
10
|
buffer[i].call();
|
11
11
|
}
|
12
|
-
},
|
13
|
-
|
14
|
-
listeners: function () {
|
15
|
-
var listeners = [];
|
16
|
-
if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
|
17
|
-
// Turbolinks 5
|
18
|
-
if (Turbolinks.BrowserAdapter) {
|
19
|
-
listeners.push('turbolinks:load');
|
20
|
-
} else {
|
21
|
-
// Turbolinks < 5
|
22
|
-
listeners.push('page:load', 'ready');
|
23
|
-
}
|
24
|
-
} else {
|
25
|
-
listeners.push('ready');
|
26
|
-
}
|
27
|
-
|
28
|
-
return listeners.join(' ');
|
29
12
|
}
|
30
13
|
};
|
31
14
|
}();
|
32
15
|
|
33
16
|
// turbolinks triggers page:load events on page transition
|
34
|
-
// If app isn't using turbolinks, this event will never be triggered, no prob.
|
35
|
-
$(document).on(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
17
|
+
// If app isn't using turbolinks, this event will never be triggered, no prob.
|
18
|
+
// $(document).on('ready') is deprecated in JQuery 1.8
|
19
|
+
if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
|
20
|
+
// Turbolinks 5
|
21
|
+
if (Turbolinks.BrowserAdapter) {
|
22
|
+
$(document).on('turbolinks:load', function() { Blacklight.activate(); });
|
23
|
+
} else {
|
24
|
+
// Turbolinks < 5
|
25
|
+
$(document).on('page:load', function() { Blacklight.activate(); });
|
26
|
+
$(document).ready(function() { Blacklight.activate(); });
|
27
|
+
}
|
28
|
+
} else {
|
29
|
+
$(document).ready(function() { Blacklight.activate(); });
|
30
|
+
}
|
@@ -56,7 +56,7 @@ module Blacklight::Catalog
|
|
56
56
|
search_session['id'] = params[:search_id]
|
57
57
|
search_session['per_page'] = params[:per_page]
|
58
58
|
|
59
|
-
if params[:redirect] and (params[:redirect].starts_with?('/') or params[:redirect] =~ URI.
|
59
|
+
if params[:redirect] and (params[:redirect].starts_with?('/') or params[:redirect] =~ URI::DEFAULT_PARSER.make_regexp)
|
60
60
|
uri = URI.parse(params[:redirect])
|
61
61
|
path = uri.query ? "#{uri.path}?#{uri.query}" : uri.path
|
62
62
|
redirect_to path, status: 303
|
@@ -42,7 +42,22 @@ module Blacklight::TokenBasedUser
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def export_secret_token
|
45
|
-
|
45
|
+
secret_key_generator.generate_key('encrypted user session key')[0..(key_len - 1)]
|
46
|
+
end
|
47
|
+
|
48
|
+
def secret_key_generator
|
49
|
+
@secret_key_generator ||= begin
|
50
|
+
app = Rails.application
|
51
|
+
|
52
|
+
secret_key_base = if app.respond_to?(:credentials)
|
53
|
+
# Rails 5.2+
|
54
|
+
app.credentials.secret_key_base
|
55
|
+
else
|
56
|
+
# Rails <= 5.1
|
57
|
+
app.secrets.secret_key_base
|
58
|
+
end
|
59
|
+
ActiveSupport::KeyGenerator.new(secret_key_base)
|
60
|
+
end
|
46
61
|
end
|
47
62
|
|
48
63
|
def message_encryptor
|
@@ -116,7 +116,9 @@ module Blacklight::BlacklightHelperBehavior
|
|
116
116
|
# @param [Blacklight::Solr::Response] response
|
117
117
|
# @return [Boolean]
|
118
118
|
def should_show_spellcheck_suggestions? response
|
119
|
-
response.total <= spell_check_max
|
119
|
+
response.total <= spell_check_max &&
|
120
|
+
!response.spelling.nil? &&
|
121
|
+
response.spelling.words.any?
|
120
122
|
end
|
121
123
|
|
122
124
|
##
|
@@ -18,6 +18,8 @@ module Blacklight
|
|
18
18
|
##
|
19
19
|
# Render "document actions" area for navigation header
|
20
20
|
# (normally renders "Saved Searches", "History", "Bookmarks")
|
21
|
+
# These things are added by add_nav_action and the default config is
|
22
|
+
# provided by DefaultComponentConfiguration
|
21
23
|
#
|
22
24
|
# @param [Hash] options
|
23
25
|
# @return [String]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div class="panel panel-default facet_limit blacklight-<%= facet_field.key.parameterize %> <%= 'facet_limit-active' if facet_field_in_params?(facet_field.key) %>">
|
2
2
|
<div class="<%= "collapsed" if should_collapse_facet?(facet_field) %> collapse-toggle panel-heading" data-toggle="collapse" data-target="#<%= facet_field_id(facet_field) %>">
|
3
3
|
<h3 class="panel-title facet-field-heading">
|
4
|
-
<%= link_to facet_field_label(facet_field.key), "#", :"data-no-turbolink" => true %>
|
4
|
+
<%= link_to facet_field_label(facet_field.key), "#", :"data-turbolinks" => false, :"data-no-turbolink" => true %>
|
5
5
|
</h3>
|
6
6
|
</div>
|
7
7
|
<div id="<%= facet_field_id(facet_field) %>" class="panel-collapse facet-content <%= should_collapse_facet?(facet_field) ? 'collapse' : 'in' %>">
|
@@ -39,7 +39,7 @@ module Blacklight
|
|
39
39
|
##
|
40
40
|
# === Single document request configuration
|
41
41
|
##
|
42
|
-
# The solr
|
42
|
+
# The solr request handler to use when requesting only a single document
|
43
43
|
document_solr_request_handler: 'document',
|
44
44
|
# THe path to send single document requests to solr
|
45
45
|
document_solr_path: nil,
|
@@ -9,12 +9,12 @@ module Blacklight
|
|
9
9
|
return if has_blacklight_assets?
|
10
10
|
|
11
11
|
contents = "\n//\n// Required by Blacklight\n"
|
12
|
-
contents += "//= require jquery\n" if
|
12
|
+
contents += "//= require jquery\n" if needs_jquery?
|
13
13
|
contents += "//= require blacklight/blacklight\n"
|
14
14
|
|
15
15
|
marker = if turbolinks?
|
16
16
|
'//= require turbolinks'
|
17
|
-
elsif
|
17
|
+
elsif needs_jquery?
|
18
18
|
'//= require rails-ujs'
|
19
19
|
else
|
20
20
|
'//= require jquery_ujs'
|
@@ -27,13 +27,13 @@ module Blacklight
|
|
27
27
|
|
28
28
|
# This is not a default in Rails 5.1
|
29
29
|
def add_jquery
|
30
|
-
gem 'jquery-rails' if
|
30
|
+
gem 'jquery-rails' if needs_jquery?
|
31
31
|
end
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
-
def
|
36
|
-
Rails.version
|
35
|
+
def needs_jquery?
|
36
|
+
Rails.version >= '5.1'
|
37
37
|
end
|
38
38
|
|
39
39
|
def turbolinks?
|
@@ -50,7 +50,19 @@ describe "Facets" do
|
|
50
50
|
expect(page).to have_selector '.facet-values li:first', text: "Japanese drama"
|
51
51
|
expect(page).to have_css '.facet-values li', count: 20
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
|
+
it 'is able to expand facets when javascript is enabled', js: true do
|
55
|
+
visit root_path
|
56
|
+
|
57
|
+
expect(page).to have_css('#facet-format', visible: false)
|
58
|
+
|
59
|
+
page.find('h3.facet-field-heading a', text: 'Format').click
|
60
|
+
|
61
|
+
sleep(1) # let facet animation finish and wait for it to potentially re-collapse
|
62
|
+
|
63
|
+
expect(page).to have_css('#facet-format', visible: true) # assert that it didn't re-collapse
|
64
|
+
end
|
65
|
+
|
54
66
|
describe '"More" links' do
|
55
67
|
it 'has default more link with sr-only text' do
|
56
68
|
visit root_path
|
@@ -240,7 +240,7 @@ describe BlacklightHelper do
|
|
240
240
|
response = double(total: 10)
|
241
241
|
expect(helper.should_show_spellcheck_suggestions? response).to be false
|
242
242
|
end
|
243
|
-
it "
|
243
|
+
it "only shows suggestions if there are very few results" do
|
244
244
|
response = double(total: 4, spelling: double(words: [1]))
|
245
245
|
expect(helper.should_show_spellcheck_suggestions? response).to be true
|
246
246
|
end
|
@@ -248,6 +248,10 @@ describe BlacklightHelper do
|
|
248
248
|
response = double(total: 4, spelling: double(words: []))
|
249
249
|
expect(helper.should_show_spellcheck_suggestions? response).to be false
|
250
250
|
end
|
251
|
+
it "does not show suggestions if spelling is not available" do
|
252
|
+
response = double(total: 4, spelling: nil)
|
253
|
+
expect(helper.should_show_spellcheck_suggestions? response).to be false
|
254
|
+
end
|
251
255
|
end
|
252
256
|
|
253
257
|
describe "#render_document_partials" do
|
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.
|
4
|
+
version: 6.15.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: 2018-
|
20
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|