bridgetown-paginate 0.17.0 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bridgetown-paginate/pagination_model.rb +14 -13
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df77a1915c24e17c2228663b2bfeae828d41a1bc7a6a74084567d6bf86780f9e
|
4
|
+
data.tar.gz: ddf253c13ea5ee94878d47510ba1eeb1c52d5d947a18dfbae36b7cbd4fa340a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9bbdf8203813db0c2d13a27be7f2a7487684e38ad22f1a58745cc318b942fc842513dfd7dd097b57afba33334bb5e66f9485490a7ae20c1f1e7db69cebde59a
|
7
|
+
data.tar.gz: 3d4846a1f14536ee7e3767f3459a80880e18124f2db310a2ce09ab91ab852e36f37e0e82fd896c3791ff8c76e8d16dfe58968cca1644ba8c9cd373c00f87f7be
|
@@ -311,7 +311,7 @@ module Bridgetown
|
|
311
311
|
|
312
312
|
# Now for each pagination page create it and configure the ranges for
|
313
313
|
# the collection
|
314
|
-
# The .
|
314
|
+
# The .paginator member is a built in thing in Bridgetown and references the
|
315
315
|
# paginator implementation
|
316
316
|
# rubocop:disable Metrics/BlockLength
|
317
317
|
(1..total_pages).each do |cur_page_nr|
|
@@ -338,9 +338,10 @@ module Bridgetown
|
|
338
338
|
end
|
339
339
|
paginated_page_url = File.join(first_index_page_url, paginated_page_url)
|
340
340
|
|
341
|
-
# 3. Create the
|
342
|
-
# page numbers, assign
|
343
|
-
|
341
|
+
# 3. Create the paginator logic for this page, pass in the prev and next
|
342
|
+
# page numbers, assign paginator to in-memory page
|
343
|
+
# TODO: remove .pager by v1.0, deprecated
|
344
|
+
newpage.paginator = newpage.pager = Paginator.new(
|
344
345
|
config["per_page"],
|
345
346
|
first_index_page_url,
|
346
347
|
paginated_page_url,
|
@@ -353,17 +354,17 @@ module Bridgetown
|
|
353
354
|
|
354
355
|
# Create the url for the new page, make sure we prepend any permalinks
|
355
356
|
# that are defined in the template page before
|
356
|
-
if newpage.
|
357
|
-
newpage.set_url(File.join(newpage.
|
358
|
-
elsif newpage.
|
357
|
+
if newpage.paginator.page_path.end_with? "/"
|
358
|
+
newpage.set_url(File.join(newpage.paginator.page_path, index_page_with_ext))
|
359
|
+
elsif newpage.paginator.page_path.end_with? index_page_ext.to_s
|
359
360
|
# Support for direct .html files
|
360
|
-
newpage.set_url(newpage.
|
361
|
+
newpage.set_url(newpage.paginator.page_path)
|
361
362
|
else
|
362
363
|
# Support for extensionless permalinks
|
363
|
-
newpage.set_url(newpage.
|
364
|
+
newpage.set_url(newpage.paginator.page_path + index_page_ext.to_s)
|
364
365
|
end
|
365
366
|
|
366
|
-
newpage.data["permalink"] = newpage.
|
367
|
+
newpage.data["permalink"] = newpage.paginator.page_path if template.data["permalink"]
|
367
368
|
|
368
369
|
# Transfer the title across to the new page
|
369
370
|
tmp_title = if !template.data["title"]
|
@@ -416,7 +417,7 @@ module Bridgetown
|
|
416
417
|
if trail_before.positive? || trail_after.positive?
|
417
418
|
newpages.select do |npage|
|
418
419
|
# Selecting the beginning of the trail
|
419
|
-
idx_start = [npage.
|
420
|
+
idx_start = [npage.paginator.page - trail_before - 1, 0].max
|
420
421
|
# Selecting the end of the trail
|
421
422
|
idx_end = [idx_start + trail_length, newpages.size.to_i].min
|
422
423
|
|
@@ -433,11 +434,11 @@ module Bridgetown
|
|
433
434
|
|
434
435
|
# Convert the newpages array into a two dimensional array that has
|
435
436
|
# [index, page_url] as items
|
436
|
-
npage.
|
437
|
+
npage.paginator.page_trail = newpages[idx_start...idx_end] \
|
437
438
|
.each_with_index.map do |ipage, idx|
|
438
439
|
PageTrail.new(
|
439
440
|
idx_start + idx + 1,
|
440
|
-
ipage.
|
441
|
+
ipage.paginator.page_path,
|
441
442
|
ipage.data["title"]
|
442
443
|
)
|
443
444
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridgetown-paginate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bridgetown-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.17.
|
19
|
+
version: 0.17.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.17.
|
26
|
+
version: 0.17.1
|
27
27
|
description:
|
28
28
|
email: maintainers@bridgetownrb.com
|
29
29
|
executables: []
|