pagy 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/config/pagy.rb +3 -3
- data/lib/javascripts/pagy.js +14 -12
- data/lib/pagy.rb +1 -1
- data/lib/pagy/extras/shared.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e12b109cdfa036177939e12f0252a8f80d8ff7212dda373285cbc617dd560354
|
4
|
+
data.tar.gz: 43678554d764fa960ebae93ceee27adda79b35b304c4c6d90b1f2ac9e03406bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 750e5d774204787364b1e8a658c721e4a3a19349f50c06e6764fdb436550513128b5ab22f438a01c46576476f404b0953188c42345dc0c898ce025217acd76aa
|
7
|
+
data.tar.gz: 16f9efe431559d358efe7532c896dafeedac33b468b18259f72a430258892d13cf313d864bd2a2bb38585b6eb2782d5655b05c67403b41e0e1475235adf3cf59
|
data/lib/config/pagy.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
# Pagy initializer file (v2.1.
|
4
|
+
# Pagy initializer file (v2.1.4)
|
5
5
|
# Customize only what you really need and notice that Pagy works also without any of the following lines.
|
6
6
|
# Should you just cherry pick part of this file, please maintain the require-order of the extras
|
7
7
|
|
@@ -60,8 +60,8 @@
|
|
60
60
|
|
61
61
|
# Breakpoints var used by the responsive nav helpers
|
62
62
|
# See https://ddnexus.github.io/pagy/extras/plain#breakpoints
|
63
|
-
#
|
64
|
-
|
63
|
+
# Pagy::VARS[:breakpoints] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] }
|
64
|
+
|
65
65
|
|
66
66
|
# Feature Extras
|
67
67
|
|
data/lib/javascripts/pagy.js
CHANGED
@@ -53,27 +53,29 @@ Pagy.responsive = function(id, tags, widths, series){
|
|
53
53
|
var pagyEl = document.getElementById(id),
|
54
54
|
container = pagyEl.parentElement,
|
55
55
|
lastWidth = undefined,
|
56
|
-
|
56
|
+
timeoutId = 0,
|
57
57
|
render = function(){
|
58
|
-
if (container.clientWidth === 0){
|
59
|
-
var width
|
58
|
+
if (container.clientWidth === 0) { rendering() }
|
59
|
+
var width, i, len;
|
60
|
+
for (i = 0, len = widths.length; i < len; i++) {
|
61
|
+
if (container.clientWidth > widths[i]) { width = widths[i]; break }
|
62
|
+
}
|
60
63
|
if (width !== lastWidth) {
|
61
64
|
while (pagyEl.firstChild) { pagyEl.removeChild(pagyEl.firstChild) }
|
62
|
-
var html
|
63
|
-
|
65
|
+
var html = tags['before'],
|
66
|
+
items = series[width];
|
67
|
+
for (i = 0, len = items.length; i < len; i++) { html += tags[items[i]] }
|
64
68
|
html += tags['after'];
|
65
69
|
pagyEl.insertAdjacentHTML('beforeend', html);
|
66
70
|
lastWidth = width;
|
67
71
|
}
|
68
72
|
},
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
};
|
73
|
-
// remove the previous window resize listener which may result in firing the render multiple times
|
73
|
+
// suppress rapid firing rendering
|
74
|
+
rendering = function(){ clearTimeout(timeoutId); timeoutId = setTimeout(render, 150) };
|
75
|
+
// refresh the window resize listener (avoiding rendering multiple times)
|
74
76
|
window.removeEventListener('resize', Pagy.windowListeners[id], true);
|
75
|
-
window.addEventListener('resize',
|
76
|
-
Pagy.windowListeners[id] =
|
77
|
+
window.addEventListener('resize', rendering, true);
|
78
|
+
Pagy.windowListeners[id] = rendering;
|
77
79
|
render();
|
78
80
|
};
|
79
81
|
|
data/lib/pagy.rb
CHANGED
data/lib/pagy/extras/shared.rb
CHANGED
@@ -14,9 +14,9 @@ class Pagy
|
|
14
14
|
# Pagy.new count:1000, page: 20, breakpoints: {0 => [1,2,2,1], 350 => [2,3,3,2], 550 => [3,4,4,3]}
|
15
15
|
# it returns something like:
|
16
16
|
# { :items => [1, :gap, 18, 19, "20", 21, 22, 50, 2, 17, 23, 49, 3, 16, 24, 48],
|
17
|
-
# :series => { 0 =>[1, :gap, 18, 19, "20", 21, 22, :gap, 50],
|
18
|
-
# 350 =>[1, 2, :gap, 17, 18, 19, "20", 21, 22, 23, :gap, 49, 50],
|
19
|
-
# 550 =>[1, 2, 3, :gap, 16, 17, 18, 19, "20", 21, 22, 23, 24, :gap, 48, 49, 50] },
|
17
|
+
# :series => { 0 => [1, :gap, 18, 19, "20", 21, 22, :gap, 50],
|
18
|
+
# 350 => [1, 2, :gap, 17, 18, 19, "20", 21, 22, 23, :gap, 49, 50],
|
19
|
+
# 550 => [1, 2, 3, :gap, 16, 17, 18, 19, "20", 21, 22, 23, 24, :gap, 48, 49, 50] },
|
20
20
|
# :widths => [550, 350, 0] }
|
21
21
|
# where :items is the unordered array union of all the page numbers for all sizes (passed to the PagyResponsive javascript function)
|
22
22
|
# :series is the hash of the series keyed by width (used by the *_responsive helpers to create the JSON string)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Domizio Demichelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Agnostic pagination in plain ruby: it works with any framework, ORM
|
14
14
|
and DB type, with all kinds of collections, even pre-paginated, scopes, Arrays,
|