blacklight 5.12.0 → 5.12.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 +4 -4
- data/VERSION +1 -1
- data/app/helpers/blacklight/catalog_helper_behavior.rb +5 -2
- data/blacklight.gemspec +1 -1
- data/lib/blacklight/document.rb +1 -43
- data/lib/blacklight/document/active_model_shim.rb +62 -0
- data/lib/blacklight/solr/document.rb +1 -0
- data/lib/blacklight/solr_response.rb +4 -0
- data/spec/helpers/blacklight_helper_spec.rb +1 -1
- data/spec/helpers/catalog_helper_spec.rb +3 -3
- data/spec/views/catalog/_index_header_default.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_thumbnail_default.erb_spec.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abad33ed78f1831cc8ae408d0d19071b667f74be
|
4
|
+
data.tar.gz: bd713d5fb66e2d1aa49b4fbcac88ff0724b0aedf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9478b659e45b4df5320395ddc301190390a7adb6d031a819761af390f07d5d59853f184381ff96fae5193c867e84b1a6bb19d86e56e9b2619c42639136697a2
|
7
|
+
data.tar.gz: 37f40ed46cca97a3f5fb1ddb49776e6ff4a41ca2318575d6cfb1f942c8a1e32ef7e2f29f73eac320f3b8d67ccc814aba6dc293e5482bf5062c82710cdd34cad1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.12.
|
1
|
+
5.12.1
|
@@ -48,9 +48,12 @@ module Blacklight::CatalogHelperBehavior
|
|
48
48
|
#
|
49
49
|
# @param [Integer] document index
|
50
50
|
# @return [Integer]
|
51
|
-
def document_counter_with_offset idx
|
51
|
+
def document_counter_with_offset idx, offset = nil
|
52
|
+
offset ||= @response.start if @response
|
53
|
+
offset ||= 0
|
54
|
+
|
52
55
|
unless render_grouped_response?
|
53
|
-
idx + 1 +
|
56
|
+
idx + 1 + offset
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
data/blacklight.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.add_dependency "rails", ">= 3.2.6", "< 5"
|
21
21
|
s.add_dependency "nokogiri", "~>1.6" # XML Parser
|
22
|
-
s.add_dependency "kaminari", "
|
22
|
+
s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
|
23
23
|
s.add_dependency "rsolr", "~> 1.0.11" # Library for interacting with rSolr.
|
24
24
|
s.add_dependency "bootstrap-sass", "~> 3.2"
|
25
25
|
s.add_dependency "deprecation"
|
data/lib/blacklight/document.rb
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
# transformation formats.
|
14
14
|
#
|
15
15
|
module Blacklight::Document
|
16
|
+
autoload :ActiveModelShim, 'blacklight/document/active_model_shim'
|
16
17
|
autoload :SchemaOrg, 'blacklight/document/schema_org'
|
17
18
|
autoload :DublinCore, 'blacklight/document/dublin_core'
|
18
19
|
autoload :Email, 'blacklight/document/email'
|
@@ -42,14 +43,6 @@ module Blacklight::Document
|
|
42
43
|
apply_extensions
|
43
44
|
end
|
44
45
|
|
45
|
-
def to_model
|
46
|
-
self
|
47
|
-
end
|
48
|
-
|
49
|
-
def persisted?
|
50
|
-
true
|
51
|
-
end
|
52
|
-
|
53
46
|
# the wrapper method to the @_source object.
|
54
47
|
# If a method is missing, it gets sent to @_source
|
55
48
|
# with all of the original params and block
|
@@ -65,14 +58,6 @@ module Blacklight::Document
|
|
65
58
|
_source_responds_to?(*args) || super
|
66
59
|
end
|
67
60
|
|
68
|
-
def [] *args
|
69
|
-
_source.send :[], *args
|
70
|
-
end
|
71
|
-
|
72
|
-
def _read_attribute(attr)
|
73
|
-
self[attr]
|
74
|
-
end
|
75
|
-
|
76
61
|
# Helper method to check if value/multi-values exist for a given key.
|
77
62
|
# The value can be a string, or a RegExp
|
78
63
|
# Multiple "values" can be given; only one needs to match.
|
@@ -138,30 +123,10 @@ module Blacklight::Document
|
|
138
123
|
Array(self[key]).first
|
139
124
|
end
|
140
125
|
|
141
|
-
def id
|
142
|
-
self[self.class.unique_key]
|
143
|
-
end
|
144
|
-
|
145
|
-
def to_param
|
146
|
-
id.to_s
|
147
|
-
end
|
148
|
-
|
149
|
-
def as_json(options = nil)
|
150
|
-
_source.as_json(options)
|
151
|
-
end
|
152
|
-
|
153
126
|
def to_partial_path
|
154
127
|
'catalog/document'
|
155
128
|
end
|
156
129
|
|
157
|
-
def destroyed?
|
158
|
-
false
|
159
|
-
end
|
160
|
-
|
161
|
-
def new_record?
|
162
|
-
false
|
163
|
-
end
|
164
|
-
|
165
130
|
def has_highlight_field? k
|
166
131
|
false
|
167
132
|
end
|
@@ -186,13 +151,6 @@ module Blacklight::Document
|
|
186
151
|
@unique_key ||= 'id'
|
187
152
|
end
|
188
153
|
|
189
|
-
def primary_key
|
190
|
-
unique_key
|
191
|
-
end
|
192
|
-
|
193
|
-
def base_class
|
194
|
-
self
|
195
|
-
end
|
196
154
|
end
|
197
155
|
|
198
156
|
private
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'active_model/conversion'
|
2
|
+
|
3
|
+
module Blacklight::Document
|
4
|
+
module ActiveModelShim
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
include ::ActiveModel::Conversion
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
def primary_key
|
11
|
+
unique_key
|
12
|
+
end
|
13
|
+
|
14
|
+
def base_class
|
15
|
+
self
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Unique ID for the document
|
21
|
+
def id
|
22
|
+
self[self.class.unique_key]
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# accessors for reading attribute
|
27
|
+
def [] *args
|
28
|
+
_source.send :[], *args
|
29
|
+
end
|
30
|
+
|
31
|
+
def _read_attribute(attr)
|
32
|
+
self[attr]
|
33
|
+
end
|
34
|
+
|
35
|
+
def as_json(options = nil)
|
36
|
+
_source.as_json(options)
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# ActiveRecord::Persistence method stubs to get non-AR objects to
|
41
|
+
# play nice with e.g. Blacklight's bookmarks
|
42
|
+
def persisted?
|
43
|
+
true
|
44
|
+
end
|
45
|
+
|
46
|
+
def destroyed?
|
47
|
+
false
|
48
|
+
end
|
49
|
+
|
50
|
+
def new_record?
|
51
|
+
false
|
52
|
+
end
|
53
|
+
|
54
|
+
##
|
55
|
+
# #to_partial_path is also defined in Blacklight::Document, but
|
56
|
+
# ActiveModel::Conversion (included above) will overwrite that..
|
57
|
+
def to_partial_path
|
58
|
+
'catalog/document'
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
@@ -462,7 +462,7 @@ describe BlacklightHelper do
|
|
462
462
|
|
463
463
|
before do
|
464
464
|
allow(helper).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
|
465
|
-
assign(:response, double("SolrResponse", grouped?: false,
|
465
|
+
assign(:response, double("SolrResponse", grouped?: false, start: 0))
|
466
466
|
allow(helper).to receive(:link_to_document).and_return('<a/>')
|
467
467
|
allow(helper).to receive(:render_index_doc_actions).and_return('<div/>')
|
468
468
|
end
|
@@ -247,19 +247,19 @@ describe CatalogHelper do
|
|
247
247
|
|
248
248
|
describe "document_counter_with_offset" do
|
249
249
|
it "should render the document index with the appropriate offset" do
|
250
|
-
assign(:response, double(:
|
250
|
+
assign(:response, double(start: 0, grouped?: false))
|
251
251
|
expect(helper.document_counter_with_offset(0)).to be(1)
|
252
252
|
expect(helper.document_counter_with_offset(1)).to be(2)
|
253
253
|
end
|
254
254
|
|
255
255
|
it "should render the document index with the appropriate offset" do
|
256
|
-
assign(:response, double(:
|
256
|
+
assign(:response, double(start: 10, grouped?: false))
|
257
257
|
expect(helper.document_counter_with_offset(0)).to be(11)
|
258
258
|
expect(helper.document_counter_with_offset(1)).to be(12)
|
259
259
|
end
|
260
260
|
|
261
261
|
it "should not provide a counter for grouped responses" do
|
262
|
-
assign(:response, double(:
|
262
|
+
assign(:response, double(start: 10, grouped?: true))
|
263
263
|
expect(helper.document_counter_with_offset(0)).to be_nil
|
264
264
|
end
|
265
265
|
end
|
@@ -10,7 +10,7 @@ describe "catalog/_index_header_default" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
before do
|
13
|
-
assign :response, double(
|
13
|
+
assign :response, double(start: 0)
|
14
14
|
allow(view).to receive(:render_grouped_response?).and_return false
|
15
15
|
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
16
16
|
allow(view).to receive(:current_search_session).and_return nil
|
@@ -17,7 +17,7 @@ describe "catalog/_thumbnail_default" do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
before do
|
20
|
-
assign :response, double(:
|
20
|
+
assign :response, double(start: 0)
|
21
21
|
allow(view).to receive(:render_grouped_response?).and_return false
|
22
22
|
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
23
23
|
allow(view).to receive(:current_search_session).and_return nil
|
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: 5.12.
|
4
|
+
version: 5.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date: 2015-03-
|
20
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -57,14 +57,14 @@ dependencies:
|
|
57
57
|
name: kaminari
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0.15'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0.15'
|
70
70
|
- !ruby/object:Gem::Dependency
|
@@ -424,6 +424,7 @@ files:
|
|
424
424
|
- lib/blacklight/configuration/view_config.rb
|
425
425
|
- lib/blacklight/controller.rb
|
426
426
|
- lib/blacklight/document.rb
|
427
|
+
- lib/blacklight/document/active_model_shim.rb
|
427
428
|
- lib/blacklight/document/dublin_core.rb
|
428
429
|
- lib/blacklight/document/email.rb
|
429
430
|
- lib/blacklight/document/export.rb
|