pagy 5.10.1 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e572ea500131186f8bec5a83e4faa287d5da1c6d4f3e33105bdd6a566fdcee01
4
- data.tar.gz: d531d964d6a73735b3d1ad7e1ec52b9c4955c273ee0631733e0a2ca495f1fd45
3
+ metadata.gz: 445ffb4fc0af5e397872edbaddd6ecee7e3815243b367000c70beb7a344ea95c
4
+ data.tar.gz: a968e0aa93a07c5ab101499284851be9080907f80435ac1e4d3e223e271e14eb
5
5
  SHA512:
6
- metadata.gz: 74bbcfbd11270579d9200db50f5a87de7e39a76320cb379c5e895d491343bf04364b5c7ff8f17af14921f96185b58a76d526c4eebd288a7dbdf72b6888c0705e
7
- data.tar.gz: 5a929cdf68d0d840f92cf97ebd57821578dc668f8c8a25db0c01e104b9f069a73b31cefe39b911a930c8b718137937d9cdb390f1c57cabd1d2bb3ba409a44312
6
+ metadata.gz: f16a561a6b5bec95ea89de6c23d114e3f01deddfb67689c54d8a5d469e9ddc40bae870daa4dcc433e68ebe4609d14cc53106da36a25e7077bdbeb098ecc350a8
7
+ data.tar.gz: dc4af89758e166dfac07d8dc0484a801e05c6dec15684c2957b8a943301999fd56ddff80459a7ceccfdf95707ec19f334c9c08297678431f5aee8ce09bc0da64
data/lib/config/pagy.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Pagy initializer file (5.10.1)
3
+ # Pagy initializer file (6.0.0)
4
4
  # Customize only what you really need and notice that the core Pagy works also without any of the following lines.
5
5
  # Should you just cherry pick part of this file, please maintain the require-order of the extras
6
6
 
@@ -28,6 +28,7 @@
28
28
  # Pagy::DEFAULT[:link_extra] = 'data-remote="true"' # example
29
29
  # Pagy::DEFAULT[:i18n_key] = 'pagy.item_name' # default
30
30
  # Pagy::DEFAULT[:cycle] = true # example
31
+ # Pagy::DEFAULT[:request_path] = "/foo" # example
31
32
 
32
33
 
33
34
  # Extras
@@ -100,8 +101,8 @@
100
101
 
101
102
  # Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
102
103
  # See https://ddnexus.github.io/pagy/extras/metadata
103
- # you must require the shared internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
104
- # require 'pagy/extras/shared'
104
+ # you must require the frontend helpers internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
105
+ # require 'pagy/extras/frontend_helpers'
105
106
  # require 'pagy/extras/metadata'
106
107
  # For performance reasons, you should explicitly set ONLY the metadata you use in the frontend
107
108
  # Pagy::DEFAULT[:metadata] = %i[scaffold_url page prev next last] # example
@@ -82,7 +82,7 @@ window.Pagy = (() => {
82
82
  const trim = (link, param) => link.replace(new RegExp(`(\\?|&)${param}=1\\b(?!&)|\\b${param}=1&`), "");
83
83
  // Public interface
84
84
  return {
85
- version: "5.10.1",
85
+ version: "6.0.0",
86
86
  // Scan for elements with a "data-pagy" attribute and call their init functions with the decoded args
87
87
  init(arg) {
88
88
  const target = arg instanceof Element ? arg : document;
@@ -111,4 +111,4 @@ window.Pagy = (() => {
111
111
  }
112
112
  };
113
113
  })();
114
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFneS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInBhZ3kudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQWNBLE1BQU0sSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFO0lBQ2YsNENBQTRDO0lBQzVDLE1BQU0sV0FBVyxHQUFHLElBQUksY0FBYyxDQUFDLE9BQU8sQ0FBQyxFQUFFLENBQzdDLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLGdCQUFnQixDQUFhLFdBQVcsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxFQUFFLENBQ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HREZWNvZGVyKCkpLmRlY29kZSh1aW50OGFycmF5KSk7IC8vIGJhc2U2NC11dGY4IC0+IEpTT04gLT4gQXJyYXlcbiAgICAgICAgICAgICAgICAgICAgaWYgKGtleXdvcmQgPT09IFwibmF2XCIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGluaXROYXYoZWwgYXMgTmF2RWxlbWVudCwgYXJncyBhcyBOYXZBcmdzKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChrZXl3b3JkID09PSBcImNvbWJvXCIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRDb21ibyhlbCwgYXJncyBhcyBDb21ib0FyZ3MpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGtleXdvcmQgPT09IFwic2VsZWN0b3JcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdFNlbGVjdG9yKGVsLCBhcmdzIGFzIFNlbGVjdG9yQXJncyk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oXCJTa2lwcGVkIFBhZ3kuaW5pdCgpIGZvcjogJW9cXG5Vbmtub3duIGtleXdvcmQgJyVzJ1wiLCBlbCwga2V5d29yZCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlcnIpIHsgY29uc29sZS53YXJuKFwiU2tpcHBlZCBQYWd5LmluaXQoKSBmb3I6ICVvXFxuJXNcIiwgZWwsIGVycikgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfTtcbn0pKCk7XG4iXX0=
114
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFneS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInBhZ3kudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQWNBLE1BQU0sSUFBSSxHQUFHL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gICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OGFycmF5ICAgICAgICAgPSBVaW50OEFycmF5LmZyb20oYXRvYihlbC5nZXRBdHRyaWJ1dGUoXCJkYXRhLXBhZ3lcIikgYXMgc3RyaW5nKSwgYyA9PiBjLmNoYXJDb2RlQXQoMCkpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBba2V5d29yZCwgLi4uYXJnc10gPSBKU09OLnBhcnNlKChuZXcgVGV4dERlY29kZXIoKSkuZGVjb2RlKHVpbnQ4YXJyYXkpKTsgLy8gYmFzZTY0LXV0ZjggLT4gSlNPTiAtPiBBcnJheVxuICAgICAgICAgICAgICAgICAgICBpZiAoa2V5d29yZCA9PT0gXCJuYXZcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdE5hdihlbCBhcyBOYXZFbGVtZW50LCBhcmdzIGFzIE5hdkFyZ3MpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGtleXdvcmQgPT09IFwiY29tYm9cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdENvbWJvKGVsLCBhcmdzIGFzIENvbWJvQXJncyk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoa2V5d29yZCA9PT0gXCJzZWxlY3RvclwiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0U2VsZWN0b3IoZWwsIGFyZ3MgYXMgU2VsZWN0b3JBcmdzKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihcIlNraXBwZWQgUGFneS5pbml0KCkgZm9yOiAlb1xcblVua25vd24ga2V5d29yZCAnJXMnXCIsIGVsLCBrZXl3b3JkKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGVycikgeyBjb25zb2xlLndhcm4oXCJTa2lwcGVkIFBhZ3kuaW5pdCgpIGZvcjogJW9cXG4lc1wiLCBlbCwgZXJyKSB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xufSkoKTtcbiJdfQ==
@@ -81,7 +81,7 @@ const Pagy = (() => {
81
81
  const trim = (link, param) => link.replace(new RegExp(`(\\?|&)${param}=1\\b(?!&)|\\b${param}=1&`), "");
82
82
  // Public interface
83
83
  return {
84
- version: "5.10.1",
84
+ version: "6.0.0",
85
85
  // Scan for elements with a "data-pagy" attribute and call their init functions with the decoded args
86
86
  init(arg) {
87
87
  const target = arg instanceof Element ? arg : document;
@@ -1 +1 @@
1
- !function(){function n(n){if(Array.isArray(n))return n}function e(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}function t(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function r(r,a){return n(r)||e(r)||t()}var a,o,i,c,u,f,l=(a=new ResizeObserver((function(n){return n.forEach((function(n){return n.target.querySelectorAll(".pagy-rjs").forEach((function(n){return n.pagyRender()}))}))})),o=function(n,e){var t,o=r(e),i=o[0],c=o[1],u=o[2],l=o[3],p=null!==(t=n.parentElement)&&void 0!==t?t:n,s=Object.keys(c).map((function(n){return parseInt(n)})).sort((function(n,e){return e-n})),y=-1,g=function(n,e,t){return n.replace(/__pagy_page__/g,e).replace(/__pagy_label__/g,t)};(n.pagyRender=function(){var e=s.find((function(n){return n<p.clientWidth}))||0;if(e!==y){var t,r=i.before,a=c[e.toString()],o=null!==(t=null==u?void 0:u[e.toString()])&&void 0!==t?t:a.map((function(n){return n.toString()}));for(var v in a){var d=a[v],_=o[v];r+="string"==typeof l&&1===d?f(g(i.link,d.toString(),_),l):"number"==typeof d?g(i.link,d.toString(),_):"gap"===d?i.gap:g(i.active,d,_)}r+=i.after,n.innerHTML="",n.insertAdjacentHTML("afterbegin",r),y=e}})(),n.classList.contains("pagy-rjs")&&a.observe(p)},i=function(n,e){var t=r(e),a=t[0],o=t[1];return u(n,(function(n){return[n,a.replace(/__pagy_page__/,n)]}),o)},c=function(n,e){var t=r(e),a=t[0],o=t[1],i=t[2];u(n,(function(n){var e=Math.max(Math.ceil(a/parseInt(n)),1).toString();return[e,o.replace(/__pagy_page__/,e).replace(/__pagy_items__/,n)]}),i)},u=function(n,e,t){var a=n.querySelector("input"),o=a.value,i=function(){if(a.value!==o){var i=r([a.min,a.value,a.max].map((function(n){return parseInt(n)||0}))),c=i[0],u=i[1],l=i[2];if(u<c||u>l)return a.value=o,void a.select();var p=r(e(a.value)),s=p[0],y=p[1];"string"==typeof t&&"1"===s&&(y=f(y,t)),n.insertAdjacentHTML("afterbegin",y),n.querySelector("a").click()}};["change","focus"].forEach((function(n){return a.addEventListener(n,a.select)})),a.addEventListener("focusout",i),a.addEventListener("keypress",(function(n){"Enter"===n.key&&i()}))},f=function(n,e){return n.replace(new RegExp("(\\?|&amp;)".concat(e,"=1\\b(?!&amp;)|\\b").concat(e,"=1&amp;")),"")},{version:"5.10.1",init:function(r){var a,u=(r instanceof Element?r:document).querySelectorAll("[data-pagy]"),f=!0,l=!1,p=void 0;try{for(var s,y=u[Symbol.iterator]();!(f=(s=y.next()).done);f=!0){var g=s.value;try{var v=Uint8Array.from(atob(g.getAttribute("data-pagy")),(function(n){return n.charCodeAt(0)})),d=n(a=JSON.parse((new TextDecoder).decode(v)))||e(a)||t(),_=d[0],m=d.slice(1);"nav"===_?o(g,m):"combo"===_?i(g,m):"selector"===_?c(g,m):console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",g,_)}catch(n){console.warn("Skipped Pagy.init() for: %o\n%s",g,n)}}}catch(n){l=!0,p=n}finally{try{f||null==y.return||y.return()}finally{if(l)throw p}}}});window.Pagy=l}();
1
+ !function(){var e=(()=>{const e=new ResizeObserver((e=>e.forEach((e=>e.target.querySelectorAll(".pagy-rjs").forEach((e=>e.pagyRender())))))),t=(t,[n,r,a,c])=>{const i=t.parentElement??t,s=Object.keys(r).map((e=>parseInt(e))).sort(((e,t)=>t-e));let p=-1;const l=(e,t,n)=>e.replace(/__pagy_page__/g,t).replace(/__pagy_label__/g,n);(t.pagyRender=function(){const e=s.find((e=>e<i.clientWidth))||0;if(e===p)return;let g=n.before;const y=r[e.toString()],f=a?.[e.toString()]??y.map((e=>e.toString()));for(const e in y){const t=y[e],r=f[e];g+="string"==typeof c&&1===t?o(l(n.link,t.toString(),r),c):"number"==typeof t?l(n.link,t.toString(),r):"gap"===t?n.gap:l(n.active,t,r)}g+=n.after,t.innerHTML="",t.insertAdjacentHTML("afterbegin",g),p=e})(),t.classList.contains("pagy-rjs")&&e.observe(i)},n=(e,[t,n])=>a(e,(e=>[e,t.replace(/__pagy_page__/,e)]),n),r=(e,[t,n,r])=>{a(e,(e=>{const r=Math.max(Math.ceil(t/parseInt(e)),1).toString();return[r,n.replace(/__pagy_page__/,r).replace(/__pagy_items__/,e)]}),r)},a=(e,t,n)=>{const r=e.querySelector("input"),a=r.value,c=function(){if(r.value===a)return;const[c,i,s]=[r.min,r.value,r.max].map((e=>parseInt(e)||0));if(i<c||i>s)return r.value=a,void r.select();let[p,l]=t(r.value);"string"==typeof n&&"1"===p&&(l=o(l,n)),e.insertAdjacentHTML("afterbegin",l),e.querySelector("a").click()};["change","focus"].forEach((e=>r.addEventListener(e,r.select))),r.addEventListener("focusout",c),r.addEventListener("keypress",(e=>{"Enter"===e.key&&c()}))},o=(e,t)=>e.replace(new RegExp(`(\\?|&amp;)${t}=1\\b(?!&amp;)|\\b${t}=1&amp;`),"");return{version:"6.0.0",init(e){const a=(e instanceof Element?e:document).querySelectorAll("[data-pagy]");for(const e of a)try{const a=Uint8Array.from(atob(e.getAttribute("data-pagy")),(e=>e.charCodeAt(0))),[o,...c]=JSON.parse((new TextDecoder).decode(a));"nav"===o?t(e,c):"combo"===o?n(e,c):"selector"===o?r(e,c):console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",e,o)}catch(t){console.warn("Skipped Pagy.init() for: %o\n%s",e,t)}}}})();window.Pagy=e}();
data/lib/locales/de.yml CHANGED
@@ -13,7 +13,7 @@ de:
13
13
  gap: "&hellip;"
14
14
 
15
15
  info:
16
- no_items: "Kein %{item_name} gefunden"
16
+ no_items: "Keine %{item_name} gefunden"
17
17
  single_page: "Zeige <b>%{count}</b> %{item_name}"
18
18
  multiple_pages: "Zeige %{item_name} <b>%{from}-%{to}</b> von <b>%{count}</b> gesamt"
19
19
 
data/lib/locales/ko.yml CHANGED
@@ -7,7 +7,7 @@ ko:
7
7
 
8
8
  nav:
9
9
  prev: "&lsaquo;&nbsp;이전"
10
- next: "이후&nbsp;&rsaquo;"
10
+ next: "다음&nbsp;&rsaquo;"
11
11
  gap: "&hellip;"
12
12
 
13
13
  info:
@@ -0,0 +1,22 @@
1
+ # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
+
3
+ nn:
4
+ pagy:
5
+
6
+ item_name:
7
+ one: "resultat"
8
+ other: "resultat"
9
+
10
+ nav:
11
+ prev: "&lsaquo;&nbsp;Førre"
12
+ next: "Neste&nbsp;&rsaquo;"
13
+ gap: "&hellip;"
14
+
15
+ info:
16
+ no_items: "Ingen %{item_name} funne"
17
+ single_page: "Viser <b>%{count}</b> %{item_name}"
18
+ multiple_pages: "Viser %{item_name} <b>%{from}-%{to}</b> av totalt <b>%{count}</b>"
19
+
20
+ combo_nav_js: "<label>Side %{page_input} av %{pages}</label>"
21
+
22
+ items_selector_js: "<label>Vis %{items_input} %{item_name} per side</label>"
@@ -15,14 +15,24 @@ class Pagy # :nodoc:
15
15
  super
16
16
  @initial = @starting.beginning_of_day
17
17
  @final = @ending.tomorrow.beginning_of_day
18
- @pages = @last = (@with_zone ? (@final.time - @initial.time) : (@final - @initial)).to_i / 1.day
18
+ @pages = @last = page_offset(@initial, @final)
19
19
  @from = starting_time_for(@page)
20
20
  @to = @from.tomorrow
21
21
  end
22
22
 
23
23
  # Starting time for the page
24
24
  def starting_time_for(page)
25
- @initial + offset_units_for(page).days
25
+ @initial.days_since(time_offset_for(page))
26
+ end
27
+
28
+ def page_offset_at(time)
29
+ page_offset(@initial, time.beginning_of_day)
30
+ end
31
+
32
+ private
33
+
34
+ def page_offset(time_a, time_b) # remove in 6.0
35
+ (time_b.time - time_a.time).to_i / 1.day
26
36
  end
27
37
  end
28
38
  end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Pagy # :nodoc:
4
+ class Calendar # :nodoc:
5
+ # Initializes the calendar objects, reducing complexity in the extra
6
+ # The returned calendar is a simple hash of units/objects with an added helper
7
+ # returning the last_object_at(time) used in the extra
8
+ class Helper < Hash
9
+ class << self
10
+ private
11
+
12
+ def init(conf, period, params)
13
+ new.send(:init, conf, period, params)
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def init(conf, period, params)
20
+ @units = Calendar::UNITS & conf.keys # get the units in time length desc order
21
+ raise ArgumentError, 'no calendar unit found in pagy_calendar @configuration' if @units.empty?
22
+
23
+ @period = period
24
+ @params = params
25
+ @page_param = conf[:pagy][:page_param] || DEFAULT[:page_param]
26
+ @conf = Marshal.load(Marshal.dump(conf)) # store a copy
27
+ @units.each do |unit| # set all the :page_param vars for later deletion
28
+ unit_page_param = :"#{unit}_#{@page_param}"
29
+ conf[unit][:page_param] = unit_page_param
30
+ conf[unit][:page] = @params[unit_page_param]
31
+ end
32
+ calendar = {}
33
+ object = nil
34
+ @units.each_with_index do |unit, index|
35
+ params_to_delete = @units[(index + 1), @units.size].map { |sub| conf[sub][:page_param] } + [@page_param]
36
+ conf[unit][:params] = lambda do |unit_params| # delete page_param from the sub-units
37
+ # Hash#except missing from ruby 2.5 baseline
38
+ params_to_delete.each { |p| unit_params.delete(p.to_s) }
39
+ unit_params
40
+ end
41
+ conf[unit][:period] = object&.send(:active_period) || @period
42
+ calendar[unit] = object = Calendar.send(:create, unit, conf[unit])
43
+ end
44
+ [replace(calendar), object.from, object.to]
45
+ end
46
+
47
+ def last_object_at(time)
48
+ conf = Marshal.load(Marshal.dump(@conf))
49
+ page_params = {}
50
+ @units.inject(nil) do |object, unit|
51
+ conf[unit][:period] = object&.send(:active_period) || @period
52
+ conf[unit][:page] = page_params[:"#{unit}_#{@page_param}"] \
53
+ = Calendar.send(:create, unit, conf[unit]).send(:page_at, time)
54
+ conf[unit][:params] ||= {}
55
+ conf[unit][:params].merge!(page_params)
56
+ Calendar.send(:create, unit, conf[unit])
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -22,7 +22,11 @@ class Pagy # :nodoc:
22
22
 
23
23
  # Starting time for the page
24
24
  def starting_time_for(page)
25
- @initial + offset_units_for(page).months
25
+ @initial.months_since(time_offset_for(page))
26
+ end
27
+
28
+ def page_offset_at(time)
29
+ months_in(time.beginning_of_month) - months_in(@initial)
26
30
  end
27
31
 
28
32
  private
@@ -29,7 +29,11 @@ class Pagy # :nodoc:
29
29
 
30
30
  # Starting time for the page
31
31
  def starting_time_for(page)
32
- @initial + (offset_units_for(page) * 3).months
32
+ @initial.months_since(time_offset_for(page) * 3)
33
+ end
34
+
35
+ def page_offset_at(time)
36
+ (months_in(time.beginning_of_quarter) - months_in(@initial)) / 3
33
37
  end
34
38
 
35
39
  private
@@ -13,21 +13,26 @@ class Pagy # :nodoc:
13
13
  # Setup the calendar variables
14
14
  def setup_unit_vars
15
15
  super
16
- if @vars[:offset] # remove in pagy 6
17
- Warning.warn '[PAGY WARNING] The week :offset variable has been deprecated and will be ignored from pagy 6. ' \
18
- "Set the Date.beginning_of_week variable to be one of #{::Date::DAYS_INTO_WEEK.keys.inspect} instead."
19
- Date.beginning_of_week = ::Date::DAYS_INTO_WEEK.keys[@vars[:offset]]
20
- end
21
16
  @initial = @starting.beginning_of_week
22
17
  @final = @ending.next_week.beginning_of_week
23
- @pages = @last = (@with_zone ? (@final.time - @initial.time) : (@final - @initial)).to_i / 1.week
18
+ @pages = @last = page_offset(@initial, @final)
24
19
  @from = starting_time_for(@page)
25
20
  @to = @from.next_week
26
21
  end
27
22
 
28
23
  # Starting time for the page
29
24
  def starting_time_for(page)
30
- @initial + offset_units_for(page).weeks
25
+ @initial.weeks_since(time_offset_for(page))
26
+ end
27
+
28
+ def page_offset_at(time)
29
+ page_offset(@initial, time.beginning_of_week)
30
+ end
31
+
32
+ private
33
+
34
+ def page_offset(time_a, time_b) # remove in 6.0
35
+ (time_b.time - time_a.time).to_i / 1.week
31
36
  end
32
37
  end
33
38
  end
@@ -22,7 +22,11 @@ class Pagy # :nodoc:
22
22
 
23
23
  # Starting time for the page
24
24
  def starting_time_for(page)
25
- @initial.years_since(offset_units_for(page))
25
+ @initial.years_since(time_offset_for(page))
26
+ end
27
+
28
+ def page_offset_at(time)
29
+ time.beginning_of_year.year - @initial.year
26
30
  end
27
31
  end
28
32
  end
data/lib/pagy/calendar.rb CHANGED
@@ -12,6 +12,9 @@ require 'pagy'
12
12
  class Pagy # :nodoc:
13
13
  # Base class for time units subclasses (Year, Quarter, Month, Week, Day)
14
14
  class Calendar < Pagy
15
+ # Specific out of range error
16
+ class OutOfRangeError < StandardError; end
17
+
15
18
  # List of units in desc order of duration. It can be used for custom units.
16
19
  UNITS = %i[year quarter month week day] # rubocop:disable Style/MutableConstant
17
20
 
@@ -45,6 +48,14 @@ class Pagy # :nodoc:
45
48
 
46
49
  protected
47
50
 
51
+ # The page that includes time
52
+ def page_at(time)
53
+ raise OutOfRangeError unless time.between?(@initial, @final)
54
+
55
+ offset = page_offset_at(time) # offset starts from 0
56
+ @order == :asc ? offset + 1 : @pages - offset
57
+ end
58
+
48
59
  # Base class method for the setup of the unit variables (subclasses must implement it and call super)
49
60
  def setup_unit_vars
50
61
  raise VariableError.new(self, :format, 'to be a strftime format', @vars[:format]) unless @vars[:format].is_a?(String)
@@ -52,10 +63,9 @@ class Pagy # :nodoc:
52
63
  unless %i[asc desc].include?(@order = @vars[:order])
53
64
 
54
65
  @starting, @ending = @vars[:period]
55
- raise VariableError.new(self, :period, 'to be a an Array of min and max local Time instances', @vars[:period]) \
56
- unless @starting.is_a?(Time) && @ending.is_a?(Time) && !@starting.utc? && !@ending.utc? && @starting <= @ending
57
-
58
- @with_zone = @starting.is_a?(ActiveSupport::TimeWithZone) # remove in 6.0 and replace Time in the line above
66
+ raise VariableError.new(self, :period, 'to be a an Array of min and max TimeWithZone instances', @vars[:period]) \
67
+ unless @starting.is_a?(ActiveSupport::TimeWithZone) \
68
+ && @ending.is_a?(ActiveSupport::TimeWithZone) && @starting <= @ending
59
69
  end
60
70
 
61
71
  # Apply the strftime format to the time (overridden by the i18n extra when localization is required)
@@ -63,9 +73,9 @@ class Pagy # :nodoc:
63
73
  time.strftime(opts[:format])
64
74
  end
65
75
 
66
- # Number of units to offset from the @initial time, in order to get the ordered starting time for the page.
67
- # Used in starting_time_for(page) with a logic equivalent to: @initial + (offset_units_for(page) * unit_time_length)
68
- def offset_units_for(page)
76
+ # Number of time units to offset from the @initial time, in order to get the ordered starting time for the page.
77
+ # Used in starting_time_for(page) where page starts from 1 (e.g. page to starting_time means subtracting 1)
78
+ def time_offset_for(page)
69
79
  @order == :asc ? page - 1 : @pages - page
70
80
  end
71
81
 
@@ -30,7 +30,7 @@ class Pagy
30
30
 
31
31
  # Override the original series.
32
32
  # Return nil if :countless_minimal is enabled
33
- def series(*)
33
+ def series(*, **)
34
34
  super unless @vars[:countless_minimal]
35
35
  end
36
36
  end
@@ -12,7 +12,7 @@ class Pagy # :nodoc:
12
12
  p_id = %( id="#{pagy_id}") if pagy_id
13
13
  link = pagy_link_proc(pagy, link_extra: %(class="page-link" #{link_extra}))
14
14
 
15
- html = +%(<nav#{p_id} class="pagy-bootstrap-nav" aria-label="pager"><ul class="pagination">)
15
+ html = +%(<nav#{p_id} class="pagy-bootstrap-nav"><ul class="pagination">)
16
16
  html << pagy_bootstrap_prev_html(pagy, link)
17
17
  pagy.series(**vars).each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
18
18
  html << case item
@@ -40,7 +40,7 @@ class Pagy # :nodoc:
40
40
  'gap' => %(<li class="page-item gap disabled"><a href="#" class="page-link">#{pagy_t 'pagy.nav.gap'}</a></li>),
41
41
  'after' => %(#{pagy_bootstrap_next_html pagy, link}</ul>) }
42
42
 
43
- %(<nav#{p_id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-bootstrap-nav-js" aria-label="pager" #{
43
+ %(<nav#{p_id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-bootstrap-nav-js" #{
44
44
  pagy_data(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></nav>)
45
45
  end
46
46
 
@@ -54,7 +54,7 @@ class Pagy # :nodoc:
54
54
  p_page}" class="text-primary" style="padding: 0; border: none; text-align: center; width: #{
55
55
  p_pages.to_s.length + 1}rem;">)
56
56
 
57
- %(<nav#{p_id} class="pagy-bootstrap-combo-nav-js pagination" aria-label="pager"><div class="btn-group" role="group" #{
57
+ %(<nav#{p_id} class="pagy-bootstrap-combo-nav-js pagination"><div class="btn-group" role="group" #{
58
58
  pagy_data(pagy, :combo, pagy_marked_link(link))}>#{
59
59
  if (p_prev = pagy.prev)
60
60
  link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous" class="prev btn btn-primary"'
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'pagy/calendar'
5
+ require 'pagy/calendar/helper'
5
6
 
6
7
  class Pagy # :nodoc:
7
8
  # Add pagination filtering by calendar unit (:year, :quarter, :month, :week, :day) to the regular pagination
@@ -18,35 +19,17 @@ class Pagy # :nodoc:
18
19
  raise ArgumentError, "keys must be in #{CONF_KEYS.inspect} and object values must be Hashes; got #{conf.inspect}"
19
20
  end
20
21
 
21
- conf[:pagy] = {} unless conf[:pagy] # use default Pagy object when omitted
22
- calendar, collection = pagy_setup_calendar(collection, conf) unless conf.key?(:active) && !conf[:active]
23
- pagy, results = send(conf[:pagy][:backend] || :pagy, collection, conf[:pagy]) # use backend: :pagy when omitted
22
+ conf[:pagy] = {} unless conf[:pagy] # use default Pagy object when omitted
23
+ unless conf.key?(:active) && !conf[:active]
24
+ calendar, from, to = Calendar::Helper.send(:init, conf, pagy_calendar_period(collection), params)
25
+ collection = pagy_calendar_filter(collection, from, to)
26
+ end
27
+ pagy, results = send(conf[:pagy][:backend] || :pagy, collection, conf[:pagy]) # use backend: :pagy when omitted
24
28
  [calendar, pagy, results]
25
29
  end
26
30
 
27
- # Setup and return the calendar objects and the filtered collection
28
- def pagy_setup_calendar(collection, conf)
29
- units = Calendar::UNITS & conf.keys # get the units in time length desc order
30
- raise ArgumentError, 'no calendar unit found in pagy_calendar configuration' if units.empty?
31
-
32
- page_param = conf[:pagy][:page_param] || DEFAULT[:page_param]
33
- units.each do |unit| # set all the :page_param vars for later deletion
34
- unit_page_param = :"#{unit}_#{page_param}"
35
- conf[unit][:page_param] = unit_page_param
36
- conf[unit][:page] = params[unit_page_param]
37
- end
38
- calendar = {}
39
- last_obj = nil
40
- units.each_with_index do |unit, index|
41
- params_to_delete = units[(index + 1), units.size].map { |sub| conf[sub][:page_param] } + [page_param]
42
- conf[unit][:params] = lambda do |params| # delete page_param from the sub-units
43
- params_to_delete.each { |p| params.delete(p.to_s) } # Hash#except missing from ruby 2.5 baseline
44
- params
45
- end
46
- conf[unit][:period] = last_obj&.send(:active_period) || pagy_calendar_period(collection)
47
- calendar[unit] = last_obj = Calendar.send(:create, unit, conf[unit])
48
- end
49
- [calendar, pagy_calendar_filter(collection, last_obj.from, last_obj.to)]
31
+ def pagy_calendar_url_at(calendar, time)
32
+ pagy_url_for(calendar.send(:last_object_at, time), 1)
50
33
  end
51
34
 
52
35
  # This method must be implemented by the application
@@ -3,16 +3,7 @@
3
3
 
4
4
  class Pagy # :nodoc:
5
5
  DEFAULT[:elasticsearch_rails_search] ||= :search
6
- DEFAULT[:elasticsearch_rails_pagy_search] ||= if DEFAULT[:elasticsearch_rails_search_method] # remove in 6.0
7
- # :nocov:
8
- Warning.warn '[PAGY WARNING] The :elasticsearch_rails_search_method variable ' \
9
- 'has been deprecated and will be ignored from pagy 6. ' \
10
- 'Use :elasticsearch_rails_pagy_search instead.'
11
- DEFAULT[:elasticsearch_rails_search_method]
12
- # :nocov:
13
- else
14
- :pagy_search
15
- end
6
+ DEFAULT[:elasticsearch_rails_pagy_search] ||= :pagy_search
16
7
 
17
8
  # Paginate ElasticsearchRails response objects
18
9
  module ElasticsearchRailsExtra
@@ -12,7 +12,7 @@ class Pagy # :nodoc:
12
12
  p_id = %( id="#{pagy_id}") if pagy_id
13
13
  link = pagy_link_proc(pagy, link_extra: link_extra)
14
14
 
15
- html = +%(<div#{p_id} class="pagy-materialize-nav pagination" role="navigation" aria-label="pager"><ul class="pagination">)
15
+ html = +%(<div#{p_id} class="pagy-materialize-nav pagination" role="navigation"><ul class="pagination">)
16
16
  html << pagy_materialize_prev_html(pagy, link)
17
17
  pagy.series(**vars).each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
18
18
  html << case item
@@ -38,7 +38,7 @@ class Pagy # :nodoc:
38
38
  'gap' => %(<li class="gap disabled"><a href="#">#{pagy_t 'pagy.nav.gap'}</a></li>),
39
39
  'after' => %(#{pagy_materialize_next_html pagy, link}</ul>) }
40
40
 
41
- %(<div#{p_id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-materialize-nav-js" role="navigation" aria-label="pager" #{
41
+ %(<div#{p_id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-materialize-nav-js" role="navigation" #{
42
42
  pagy_data(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></div>)
43
43
  end
44
44
 
@@ -53,7 +53,7 @@ class Pagy # :nodoc:
53
53
  p_page}" style="text-align: center; width: #{p_pages.to_s.length + 1}rem;">)
54
54
 
55
55
  html = %(<ul#{p_id} class="pagy-materialize-combo-nav-js pagination chip" role="navigation")
56
- %(#{html} aria-label="pager" style="padding-right: 0" #{
56
+ %(#{html} style="padding-right: 0" #{
57
57
  pagy_data(pagy, :combo, pagy_marked_link(link))}>#{
58
58
  pagy_materialize_prev_html pagy, link, style}<li class="pagy-combo-input">#{
59
59
  pagy_t 'pagy.combo_nav_js', page_input: input, count: p_page, pages: p_pages}</li>#{
@@ -2,16 +2,8 @@
2
2
 
3
3
  class Pagy # :nodoc:
4
4
  DEFAULT[:meilisearch_search] ||= :ms_search
5
- DEFAULT[:meilisearch_pagy_search] ||= if DEFAULT[:meilisearch_search_method] # remove in 6.0
6
- # :nocov:
7
- Warning.warn '[PAGY WARNING] The :meilisearch_search_method variable ' \
8
- 'has been deprecated and will be ignored from pagy 6. ' \
9
- 'Use :meilisearch_pagy_search instead.'
10
- DEFAULT[:meilisearch_search_method]
11
- # :nocov:
12
- else
13
- :pagy_search
14
- end
5
+ DEFAULT[:meilisearch_pagy_search] ||= :pagy_search
6
+
15
7
  # Paginate Meilisearch results
16
8
  module MeilisearchExtra
17
9
  module Meilisearch # :nodoc:
@@ -27,9 +19,10 @@ class Pagy # :nodoc:
27
19
  module Pagy
28
20
  # Create a Pagy object from a Meilisearch results
29
21
  def new_from_meilisearch(results, vars = {})
30
- vars[:items] = results.raw_answer['limit']
31
- vars[:page] = (results.raw_answer['offset'] / vars[:items]) + 1
32
- vars[:count] = results.raw_answer['nbHits']
22
+ vars[:items] = results.raw_answer['hitsPerPage']
23
+ vars[:page] = results.raw_answer['page']
24
+ vars[:count] = results.raw_answer['totalHits']
25
+
33
26
  new(vars)
34
27
  end
35
28
  end
@@ -40,13 +33,14 @@ class Pagy # :nodoc:
40
33
 
41
34
  # Return Pagy object and results
42
35
  def pagy_meilisearch(pagy_search_args, vars = {})
43
- model, term, options = pagy_search_args
44
- vars = pagy_meilisearch_get_vars(nil, vars)
45
- options[:limit] = vars[:items]
46
- options[:offset] = (vars[:page] - 1) * vars[:items]
47
- results = model.send(DEFAULT[:meilisearch_search], term, **options)
48
- vars[:count] = results.raw_answer['nbHits']
49
- pagy = ::Pagy.new(vars)
36
+ model, term, options = pagy_search_args
37
+ vars = pagy_meilisearch_get_vars(nil, vars)
38
+ options[:hits_per_page] = vars[:items]
39
+ options[:page] = vars[:page]
40
+ results = model.send(:ms_search, term, **options)
41
+ vars[:count] = results.raw_answer['totalHits']
42
+
43
+ pagy = ::Pagy.new(vars)
50
44
  # with :last_page overflow we need to re-run the method in order to get the hits
51
45
  return pagy_meilisearch(pagy_search_args, vars.merge(page: pagy.page)) \
52
46
  if defined?(::Pagy::OverflowExtra) && pagy.overflow? && pagy.vars[:overflow] == :last_page
@@ -18,7 +18,7 @@ class Pagy # :nodoc:
18
18
  'gap' => %(<span class="page gap">#{pagy_t 'pagy.nav.gap'}</span> ),
19
19
  'after' => pagy_nav_next_html(pagy, link) }
20
20
 
21
- %(<nav#{p_id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-nav-js pagination" aria-label="pager" #{
21
+ %(<nav#{p_id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-nav-js pagination" #{
22
22
  pagy_data(pagy, :nav, tags, sequels, pagy.label_sequels(sequels))}></nav>)
23
23
  end
24
24
 
@@ -31,7 +31,7 @@ class Pagy # :nodoc:
31
31
  input = %(<input type="number" min="1" max="#{p_pages}" value="#{
32
32
  p_page}" style="padding: 0; text-align: center; width: #{p_pages.to_s.length + 1}rem;">)
33
33
 
34
- %(<nav#{p_id} class="pagy-combo-nav-js pagination" aria-label="pager" #{
34
+ %(<nav#{p_id} class="pagy-combo-nav-js pagination" #{
35
35
  pagy_data(pagy, :combo, pagy_marked_link(link))}>#{
36
36
  pagy_nav_prev_html pagy, link
37
37
  }<span class="pagy-combo-input" style="margin: 0 0.6rem;">#{
@@ -3,16 +3,8 @@
3
3
 
4
4
  class Pagy # :nodoc:
5
5
  DEFAULT[:searchkick_search] ||= :search
6
- DEFAULT[:searchkick_pagy_search] ||= if DEFAULT[:searchkick_search_method] # remove in 6.0
7
- # :nocov:
8
- Warning.warn '[PAGY WARNING] The :searchkick_search_method variable ' \
9
- 'has been deprecated and will be ignored from pagy 6. ' \
10
- 'Use :searchkick_pagy_search instead.'
11
- DEFAULT[:searchkick_search_method]
12
- # :nocov:
13
- else
14
- :pagy_search
15
- end
6
+ DEFAULT[:searchkick_pagy_search] ||= :pagy_search
7
+
16
8
  # Paginate Searchkick::Results objects
17
9
  module SearchkickExtra
18
10
  module Searchkick # :nodoc:
@@ -8,6 +8,7 @@ class Pagy # :nodoc:
8
8
  # even in the irb/rails console without any app or config.
9
9
  module StandaloneExtra
10
10
  # Extracted from Rack::Utils and reformatted for rubocop
11
+ # :nocov:
11
12
  module QueryUtils
12
13
  module_function
13
14
 
@@ -32,6 +33,7 @@ class Pagy # :nodoc:
32
33
  end
33
34
  end
34
35
  end
36
+ # :nocov:
35
37
 
36
38
  # Return the URL for the page. If there is no pagy.vars[:url]
37
39
  # it works exactly as the regular #pagy_url_for, relying on the params method and Rack.
@@ -45,9 +47,8 @@ class Pagy # :nodoc:
45
47
  params = pagy.params.is_a?(Hash) ? pagy.params.clone : {} # safe when it gets reused
46
48
  params[page_param] = page
47
49
  params[items_param] = vars[:items] if vars[:items_extra]
48
- query_string = "?#{QueryUtils.build_nested_query(pagy_deprecated_params(pagy, params))}" # remove in 6.0
49
- # params = pagy.params.call(params) if pagy.params.is_a?(Proc) # add in 6.0
50
- # query_string = "?#{Rack::Utils.build_nested_query(params)}" # add in 6.0
50
+ params = pagy.params.call(params) if pagy.params.is_a?(Proc)
51
+ query_string = "?#{Rack::Utils.build_nested_query(params)}"
51
52
  query_string = query_string.gsub('&', '&amp;') if html_escaped # the only unescaped entity
52
53
  "#{vars[:url]}#{query_string}#{vars[:fragment]}"
53
54
  end
data/lib/pagy/frontend.rb CHANGED
@@ -21,7 +21,7 @@ class Pagy
21
21
  p_prev = pagy.prev
22
22
  p_next = pagy.next
23
23
 
24
- html = +%(<nav#{p_id} class="pagy-nav pagination" aria-label="pager">)
24
+ html = +%(<nav#{p_id} class="pagy-nav pagination">)
25
25
  html << if p_prev
26
26
  %(<span class="page prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</span> )
27
27
  else
@@ -8,32 +8,17 @@ class Pagy
8
8
  # For non-rack environments you can use the standalone extra
9
9
  def pagy_url_for(pagy, page, absolute: false, html_escaped: false)
10
10
  vars = pagy.vars
11
+ request_path = vars[:request_path].to_s.empty? ? request.path : vars[:request_path]
11
12
  page_param = vars[:page_param].to_s
12
13
  items_param = vars[:items_param].to_s
13
14
  params = pagy.params.is_a?(Hash) ? pagy.params.transform_keys(&:to_s) : {}
14
15
  params = request.GET.merge(params)
15
16
  params[page_param] = page
16
17
  params[items_param] = vars[:items] if vars[:items_extra]
17
- query_string = "?#{Rack::Utils.build_nested_query(pagy_deprecated_params(pagy, params))}" # remove in 6.0
18
- # params = pagy.params.call(params) if pagy.params.is_a?(Proc) # add in 6.0
19
- # query_string = "?#{Rack::Utils.build_nested_query(params)}" # add in 6.0
18
+ params = pagy.params.call(params) if pagy.params.is_a?(Proc)
19
+ query_string = "?#{Rack::Utils.build_nested_query(params)}"
20
20
  query_string = query_string.gsub('&', '&amp;') if html_escaped # the only unescaped entity
21
- "#{request.base_url if absolute}#{request.path}#{query_string}#{vars[:fragment]}"
22
- end
23
-
24
- private
25
-
26
- # Transitional code to handle params deprecations. It will be removed in version 6.0
27
- def pagy_deprecated_params(pagy, params) # remove in 6.0
28
- if pagy.params.is_a?(Proc) # new code
29
- pagy.params.call(params)
30
- elsif respond_to?(:pagy_massage_params) # deprecated code
31
- Warning.warn '[PAGY WARNING] The pagy_massage_params method has been deprecated and it will be ignored from version 6. ' \
32
- 'Set the :params variable to a Proc with the same code as the pagy_massage_params method.'
33
- pagy_massage_params(params)
34
- else
35
- params # no massage params
36
- end
21
+ "#{request.base_url if absolute}#{request_path}#{query_string}#{vars[:fragment]}"
37
22
  end
38
23
  end
39
24
  end
data/lib/pagy.rb CHANGED
@@ -5,7 +5,7 @@ require 'pathname'
5
5
 
6
6
  # Core class
7
7
  class Pagy
8
- VERSION = '5.10.1'
8
+ VERSION = '6.0.0'
9
9
 
10
10
  # Root pathname to get the path of Pagy files like templates or dictionaries
11
11
  def self.root
@@ -22,9 +22,10 @@ class Pagy
22
22
  fragment: '',
23
23
  link_extra: '',
24
24
  i18n_key: 'pagy.item_name',
25
- cycle: false }
25
+ cycle: false,
26
+ request_path: '' }
26
27
 
27
- attr_reader :count, :page, :items, :vars, :pages, :last, :offset, :in, :from, :to, :prev, :next, :params
28
+ attr_reader :count, :page, :items, :vars, :pages, :last, :offset, :in, :from, :to, :prev, :next, :params, :request_path
28
29
 
29
30
  # Merge and validate the options, do some simple arithmetic and set the instance variables
30
31
  def initialize(vars)
@@ -34,6 +35,7 @@ class Pagy
34
35
  setup_pages_var
35
36
  setup_offset_var
36
37
  setup_params_var
38
+ setup_request_path_var
37
39
  raise OverflowError.new(self, :page, "in 1..#{@last}", @page) if @page > @last
38
40
 
39
41
  @from = [@offset - @outset + 1, @count].min
@@ -92,7 +94,7 @@ class Pagy
92
94
  def setup_vars(name_min)
93
95
  name_min.each do |name, min|
94
96
  raise VariableError.new(self, name, ">= #{min}", @vars[name]) \
95
- unless @vars[name] && instance_variable_set(:"@#{name}", @vars[name].to_i) >= min
97
+ unless @vars[name]&.respond_to?(:to_i) && instance_variable_set(:"@#{name}", @vars[name].to_i) >= min
96
98
  end
97
99
  end
98
100
 
@@ -116,6 +118,16 @@ class Pagy
116
118
  raise VariableError.new(self, :params, 'must be a Hash or a Proc', @params) \
117
119
  unless (@params = @vars[:params]).is_a?(Hash) || @params.is_a?(Proc)
118
120
  end
121
+
122
+ def setup_request_path_var
123
+ request_path = @vars[:request_path]
124
+ return if request_path.to_s.empty?
125
+
126
+ raise VariableError.new(self, :request_path, 'must be a bare path like "/foo"', request_path) \
127
+ if !request_path.start_with?('/') || request_path.include?('?')
128
+
129
+ @request_path = request_path
130
+ end
119
131
  end
120
132
 
121
133
  require 'pagy/backend'
@@ -6,7 +6,7 @@
6
6
  Usage: link.call( page_number [, text [, extra_attributes_string ]])
7
7
  -%>
8
8
  <% link = pagy_link_proc(pagy, link_extra: 'class="page-link"') -%>
9
- <%# -%><nav aria-label="pager" class="pagy-bootstrap-nav" role="navigation">
9
+ <%# -%><nav class="pagy-bootstrap-nav" role="navigation">
10
10
  <%# -%> <ul class="pagination">
11
11
  <% if pagy.prev -%> <li class="page-item prev"><%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"') %></li>
12
12
  <% else -%> <li class="page-item prev disabled"><a href="#" class="page-link"><%== pagy_t('pagy.nav.prev') %></a></li>
@@ -6,7 +6,7 @@
6
6
 
7
7
  - link = pagy_link_proc(pagy, link_extra: 'class="page-link"')
8
8
 
9
- %nav.pagy-bootstrap-nav{"aria-label" => "pager", :role => "navigation"}
9
+ %nav.pagy-bootstrap-nav{:role => "navigation"}
10
10
 
11
11
  %ul.pagination
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  - link = pagy_link_proc(pagy, link_extra: 'class="page-link"')
8
8
 
9
- nav.pagy-bootstrap-nav role="navigation" aria-label="pager"
9
+ nav.pagy-bootstrap-nav role="navigation"
10
10
 
11
11
  ul.pagination
12
12
 
@@ -6,7 +6,7 @@
6
6
  Usage: link.call( page_number [, text [, extra_attributes_string ]])
7
7
  -%>
8
8
  <% link = pagy_link_proc(pagy) -%>
9
- <%# -%><nav aria-label="pager" class="pagy_nav pagination" role="navigation">
9
+ <%# -%><nav class="pagy_nav pagination" role="navigation">
10
10
  <% if pagy.prev -%> <span class="page prev"><%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"') %></span>
11
11
  <% else -%> <span class="page prev disabled"><%== pagy_t('pagy.nav.prev') %></span>
12
12
  <% end -%>
@@ -6,7 +6,7 @@
6
6
 
7
7
  - link = pagy_link_proc(pagy)
8
8
 
9
- %nav.pagy_nav.pagination{"aria-label" => "pager", :role => "navigation"}
9
+ %nav.pagy_nav.pagination{:role => "navigation"}
10
10
 
11
11
  - if pagy.prev
12
12
  %span.page.prev!= link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')
@@ -6,7 +6,7 @@
6
6
 
7
7
  - link = pagy_link_proc(pagy)
8
8
 
9
- nav.pagy_nav.pagination role="navigation" aria-label="pager"
9
+ nav.pagy_nav.pagination role="navigation"
10
10
 
11
11
  - if pagy.prev
12
12
  span.page.prev ==> link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagy
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.10.1
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-03 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
11
+ date: 2022-12-22 00:00:00.000000000 Z
12
+ dependencies: []
27
13
  description: Agnostic pagination in plain ruby. It does it all. Better.
28
14
  email:
29
15
  - dd.nexus@gmail.com
@@ -55,6 +41,7 @@ files:
55
41
  - lib/locales/ko.yml
56
42
  - lib/locales/nb.yml
57
43
  - lib/locales/nl.yml
44
+ - lib/locales/nn.yml
58
45
  - lib/locales/pl.yml
59
46
  - lib/locales/pt-BR.yml
60
47
  - lib/locales/pt.yml
@@ -73,6 +60,7 @@ files:
73
60
  - lib/pagy/backend.rb
74
61
  - lib/pagy/calendar.rb
75
62
  - lib/pagy/calendar/day.rb
63
+ - lib/pagy/calendar/helper.rb
76
64
  - lib/pagy/calendar/month.rb
77
65
  - lib/pagy/calendar/quarter.rb
78
66
  - lib/pagy/calendar/week.rb
@@ -131,7 +119,7 @@ metadata:
131
119
  documentation_uri: https://ddnexus.github.io/pagy
132
120
  bug_tracker_uri: https://github.com/ddnexus/pagy/issues
133
121
  changelog_uri: https://github.com/ddnexus/pagy/blob/master/CHANGELOG.md
134
- live_support: https://gitter.im/ruby-pagy/Lobby
122
+ support: https://github.com/ddnexus/pagy/discussions/categories/q-a
135
123
  post_install_message:
136
124
  rdoc_options: []
137
125
  require_paths:
@@ -147,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
135
  - !ruby/object:Gem::Version
148
136
  version: '0'
149
137
  requirements: []
150
- rubygems_version: 3.2.32
138
+ rubygems_version: 3.2.33
151
139
  signing_key:
152
140
  specification_version: 4
153
141
  summary: The kick-ass pagination ruby gem