blacklight 5.17.1 → 5.17.2
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/models/blacklight/facet_paginator.rb +3 -2
- data/spec/models/blacklight/facet_paginator_spec.rb +15 -4
- 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: cb02cacbad8a1eae5549c29ea63d69d742755284
|
4
|
+
data.tar.gz: 5ce395c3e3dc278d89fdec2dfbc56845377db6ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09f6375583aa2751d3420688eb39dec519f92fb7cbd99b993ff8616e59246c9716c7d33d00c139bb7e7b890550c04f36a584e33d8ad091bd3fd2bc22236c03d5
|
7
|
+
data.tar.gz: 3dbf5104d494af8f835fb76b7e1bdbe1093dd40705d3fcc4ee6545b475c66f71b8dc6378c7c6265b9ca3ca662bdf765689207369327ef8d8c5bb84d953ba7e9d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.17.
|
1
|
+
5.17.2
|
@@ -36,7 +36,7 @@ module Blacklight
|
|
36
36
|
# :sort => 'count' or 'index', solr tokens for facet value sorting, default 'count'.
|
37
37
|
def initialize(all_facet_values, arguments)
|
38
38
|
# to_s.to_i will conveniently default to 0 if nil
|
39
|
-
@offset = arguments[:offset].to_s.to_i
|
39
|
+
@offset = arguments[:offset].to_s.to_i
|
40
40
|
@limit = arguments[:limit]
|
41
41
|
@sort = arguments[:sort]
|
42
42
|
|
@@ -57,7 +57,8 @@ module Blacklight
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def current_page
|
60
|
-
|
60
|
+
# A nil limit is unlimited, thus only one page.
|
61
|
+
if limit.nil? || limit == 0 #check for divide by zero
|
61
62
|
1
|
62
63
|
else
|
63
64
|
@offset / limit + 1
|
@@ -71,11 +71,22 @@ describe Blacklight::FacetPaginator do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
context "for a nil :limit" do
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
let(:paginator) { described_class.new(seven_facet_values, offset: 0, limit: nil) }
|
75
|
+
|
76
|
+
describe "#items" do
|
77
|
+
subject { paginator.items }
|
78
|
+
it { is_expected.to eq seven_facet_values }
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "#last_page?" do
|
82
|
+
subject { paginator.last_page? }
|
83
|
+
it { is_expected.to be true }
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "#current_page" do
|
87
|
+
subject { paginator.current_page }
|
88
|
+
it { is_expected.to eq 1 }
|
77
89
|
end
|
78
|
-
it { should be_last_page }
|
79
90
|
end
|
80
91
|
|
81
92
|
describe "#as_json" 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: 5.17.
|
4
|
+
version: 5.17.2
|
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:
|
20
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|