pagy 6.0.0 → 7.0.0

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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/lib/config/pagy.rb +56 -44
  4. data/lib/javascripts/pagy-dev.js +3 -3
  5. data/lib/javascripts/pagy-module.js +2 -2
  6. data/lib/javascripts/pagy.js +1 -1
  7. data/lib/locales/ar.yml +15 -11
  8. data/lib/locales/be.yml +25 -0
  9. data/lib/locales/bg.yml +10 -11
  10. data/lib/locales/bs.yml +12 -11
  11. data/lib/locales/ca.yml +12 -11
  12. data/lib/locales/cs.yml +13 -10
  13. data/lib/locales/da.yml +14 -13
  14. data/lib/locales/de.yml +10 -11
  15. data/lib/locales/en.yml +10 -11
  16. data/lib/locales/es.yml +10 -11
  17. data/lib/locales/fr.yml +10 -11
  18. data/lib/locales/hr.yml +12 -11
  19. data/lib/locales/id.yml +10 -11
  20. data/lib/locales/it.yml +10 -11
  21. data/lib/locales/ja.yml +10 -11
  22. data/lib/locales/km.yml +10 -10
  23. data/lib/locales/ko.yml +10 -11
  24. data/lib/locales/nb.yml +10 -11
  25. data/lib/locales/nl.yml +10 -11
  26. data/lib/locales/nn.yml +10 -11
  27. data/lib/locales/pl.yml +12 -11
  28. data/lib/locales/pt-BR.yml +10 -11
  29. data/lib/locales/pt.yml +10 -11
  30. data/lib/locales/ru.yml +14 -11
  31. data/lib/locales/sr.yml +12 -10
  32. data/lib/locales/sv-SE.yml +10 -12
  33. data/lib/locales/sv.yml +10 -12
  34. data/lib/locales/sw.yml +12 -11
  35. data/lib/locales/ta.yml +12 -11
  36. data/lib/locales/tr.yml +10 -11
  37. data/lib/locales/uk.yml +12 -11
  38. data/lib/locales/vi.yml +17 -0
  39. data/lib/locales/zh-CN.yml +10 -11
  40. data/lib/locales/zh-HK.yml +10 -11
  41. data/lib/locales/zh-TW.yml +10 -11
  42. data/lib/pagy/backend.rb +10 -4
  43. data/lib/pagy/calendar/day.rb +4 -3
  44. data/lib/pagy/calendar/helper.rb +15 -11
  45. data/lib/pagy/calendar/month.rb +4 -3
  46. data/lib/pagy/calendar/quarter.rb +4 -3
  47. data/lib/pagy/calendar/week.rb +1 -1
  48. data/lib/pagy/calendar/year.rb +3 -2
  49. data/lib/pagy/calendar.rb +33 -7
  50. data/lib/pagy/console.rb +1 -1
  51. data/lib/pagy/countless.rb +1 -1
  52. data/lib/pagy/exceptions.rb +1 -1
  53. data/lib/pagy/extras/arel.rb +1 -1
  54. data/lib/pagy/extras/array.rb +1 -1
  55. data/lib/pagy/extras/bootstrap.rb +45 -32
  56. data/lib/pagy/extras/bulma.rb +41 -32
  57. data/lib/pagy/extras/calendar.rb +17 -13
  58. data/lib/pagy/extras/countless.rb +1 -1
  59. data/lib/pagy/extras/elasticsearch_rails.rb +8 -8
  60. data/lib/pagy/extras/foundation.rb +48 -33
  61. data/lib/pagy/extras/frontend_helpers.rb +11 -11
  62. data/lib/pagy/extras/gearbox.rb +1 -1
  63. data/lib/pagy/extras/headers.rb +8 -8
  64. data/lib/pagy/extras/i18n.rb +5 -5
  65. data/lib/pagy/extras/items.rb +19 -12
  66. data/lib/pagy/extras/jsonapi.rb +79 -0
  67. data/lib/pagy/extras/materialize.rb +42 -30
  68. data/lib/pagy/extras/meilisearch.rb +12 -11
  69. data/lib/pagy/extras/metadata.rb +2 -2
  70. data/lib/pagy/extras/navs.rb +22 -34
  71. data/lib/pagy/extras/overflow.rb +9 -7
  72. data/lib/pagy/extras/searchkick.rb +8 -8
  73. data/lib/pagy/extras/semantic.rb +41 -28
  74. data/lib/pagy/extras/standalone.rb +10 -16
  75. data/lib/pagy/extras/support.rb +19 -33
  76. data/lib/pagy/extras/trim.rb +4 -4
  77. data/lib/pagy/extras/uikit.rb +44 -31
  78. data/lib/pagy/frontend.rb +57 -26
  79. data/lib/pagy/i18n.rb +3 -3
  80. data/lib/pagy/url_helpers.rb +15 -12
  81. data/lib/pagy.rb +57 -41
  82. metadata +7 -19
  83. data/lib/templates/bootstrap_nav.html.erb +0 -24
  84. data/lib/templates/bootstrap_nav.html.haml +0 -34
  85. data/lib/templates/bootstrap_nav.html.slim +0 -34
  86. data/lib/templates/bulma_nav.html.erb +0 -24
  87. data/lib/templates/bulma_nav.html.haml +0 -32
  88. data/lib/templates/bulma_nav.html.slim +0 -32
  89. data/lib/templates/foundation_nav.html.erb +0 -24
  90. data/lib/templates/foundation_nav.html.haml +0 -34
  91. data/lib/templates/foundation_nav.html.slim +0 -34
  92. data/lib/templates/nav.html.erb +0 -22
  93. data/lib/templates/nav.html.haml +0 -30
  94. data/lib/templates/nav.html.slim +0 -29
  95. data/lib/templates/uikit_nav.html.erb +0 -15
  96. data/lib/templates/uikit_nav.html.haml +0 -28
  97. data/lib/templates/uikit_nav.html.slim +0 -28
data/lib/pagy.rb CHANGED
@@ -1,11 +1,11 @@
1
- # See Pagy API documentation: https://ddnexus.github.io/pagy/api/pagy
1
+ # See Pagy API documentation: https://ddnexus.github.io/pagy/docs/api/pagy
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'pathname'
5
5
 
6
6
  # Core class
7
7
  class Pagy
8
- VERSION = '6.0.0'
8
+ VERSION = '7.0.0'
9
9
 
10
10
  # Root pathname to get the path of Pagy files like templates or dictionaries
11
11
  def self.root
@@ -13,17 +13,19 @@ class Pagy
13
13
  end
14
14
 
15
15
  # Default core vars: constant for easy access, but mutable for customizable defaults
16
- DEFAULT = { page: 1, # rubocop:disable Style/MutableConstant
17
- items: 20,
18
- outset: 0,
19
- size: [1, 4, 4, 1],
20
- page_param: :page,
21
- params: {},
22
- fragment: '',
23
- link_extra: '',
24
- i18n_key: 'pagy.item_name',
25
- cycle: false,
26
- request_path: '' }
16
+ DEFAULT = { page: 1, # rubocop:disable Style/MutableConstant
17
+ items: 20,
18
+ outset: 0,
19
+ size: 7,
20
+ page_param: :page,
21
+ params: {},
22
+ fragment: '',
23
+ link_extra: '',
24
+ item_i18n_key: 'pagy.item_name',
25
+ nav_i18n_key: 'pagy.aria_label.nav',
26
+ cycle: false,
27
+ request_path: '',
28
+ count_args: [:all] } # AR friendly
27
29
 
28
30
  attr_reader :count, :page, :items, :vars, :pages, :last, :offset, :in, :from, :to, :prev, :next, :params, :request_path
29
31
 
@@ -38,47 +40,61 @@ class Pagy
38
40
  setup_request_path_var
39
41
  raise OverflowError.new(self, :page, "in 1..#{@last}", @page) if @page > @last
40
42
 
41
- @from = [@offset - @outset + 1, @count].min
42
- @to = [@offset - @outset + @items, @count].min
43
- @in = [@to - @from + 1, @count].min
44
- @prev = (@page - 1 unless @page == 1)
45
- @next = @page == @last ? (1 if @vars[:cycle]) : @page + 1
43
+ @from = [@offset - @outset + 1, @count].min
44
+ @to = [@offset - @outset + @items, @count].min
45
+ @in = [@to - @from + 1, @count].min
46
+ @prev = (@page - 1 unless @page == 1)
47
+ @next = @page == @last ? (1 if @vars[:cycle]) : @page + 1
46
48
  end
47
49
 
48
50
  # Return the array of page numbers and :gap items e.g. [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
49
51
  def series(size: @vars[:size], **_)
50
- return [] if size.empty?
51
- raise VariableError.new(self, :size, 'to contain 4 items >= 0', size) \
52
- unless size.is_a?(Array) && size.size == 4 && size.all? { |num| !num.negative? rescue false } # rubocop:disable Style/RescueModifier
53
-
54
- # This algorithm is up to ~5x faster and ~2.3x lighter than the previous one (pagy < 4.3)
55
- left_gap_start = 1 + size[0] # rubocop:disable Layout/ExtraSpacing, Layout/SpaceAroundOperators
56
- left_gap_end = @page - size[1] - 1
57
- right_gap_start = @page + size[2] + 1
58
- right_gap_end = @last - size[3]
59
- left_gap_end = right_gap_end if left_gap_end > right_gap_end
60
- right_gap_start = left_gap_start if left_gap_start > right_gap_start
61
- series = []
62
- start = 1
63
- if (left_gap_end - left_gap_start).positive?
64
- series.push(*start...left_gap_start, :gap)
65
- start = left_gap_end + 1
52
+ series = []
53
+ if size.is_a?(Array) && size.size == 4 && size.all? { |num| !num.negative? rescue false } # rubocop:disable Style/RescueModifier
54
+ # This algorithm is up to ~5x faster and ~2.3x lighter than the previous one (pagy < 4.3)
55
+ left_gap_start = 1 + size[0]
56
+ left_gap_end = @page - size[1] - 1
57
+ right_gap_start = @page + size[2] + 1
58
+ right_gap_end = @last - size[3]
59
+ left_gap_end = right_gap_end if left_gap_end > right_gap_end
60
+ right_gap_start = left_gap_start if left_gap_start > right_gap_start
61
+ start = 1
62
+ if (left_gap_end - left_gap_start).positive?
63
+ series.push(*start...left_gap_start, :gap)
64
+ start = left_gap_end + 1
65
+ end
66
+ if (right_gap_end - right_gap_start).positive?
67
+ series.push(*start...right_gap_start, :gap)
68
+ start = right_gap_end + 1
69
+ end
70
+ series.push(*start..@last)
71
+ elsif size.is_a?(Integer) && size.positive? # only central series
72
+ # The simplest and fastest algorithm
73
+ size = @pages if size > @pages # reduce the max size to @pages
74
+ left = ((size - 1) / 2.0).floor # left half might be 1 page shorter for even size
75
+ start = if @page <= left # beginning pages
76
+ 1
77
+ elsif @page > @pages - (size - left) # end pages
78
+ @pages - size + 1
79
+ else # intermediate pages
80
+ @page - left
81
+ end
82
+ series = (start..start + size - 1).to_a
83
+ else
84
+ return [] if size.empty?
85
+
86
+ raise VariableError.new(self, :size, 'to be a single positive Integer or an Array of 4', size)
66
87
  end
67
- if (right_gap_end - right_gap_start).positive?
68
- series.push(*start...right_gap_start, :gap)
69
- start = right_gap_end + 1
70
- end
71
- series.push(*start..@last)
72
88
  series[series.index(@page)] = @page.to_s
73
89
  series
74
90
  end
75
91
 
76
- # Allow the customization of the output (overridden by the calendar extra)
92
+ # Label for any page. Allow the customization of the output (overridden by the calendar extra)
77
93
  def label_for(page)
78
94
  page.to_s
79
95
  end
80
96
 
81
- # Allow the customization of the output (overridden by the calendar extra)
97
+ # Label for the current page. Allow the customization of the output (overridden by the calendar extra)
82
98
  def label
83
99
  @page.to_s
84
100
  end
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: 6.0.0
4
+ version: 7.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-12-22 00:00:00.000000000 Z
11
+ date: 2024-02-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Agnostic pagination in plain ruby. It does it all. Better.
14
14
  email:
@@ -24,6 +24,7 @@ files:
24
24
  - lib/javascripts/pagy-module.js
25
25
  - lib/javascripts/pagy.js
26
26
  - lib/locales/ar.yml
27
+ - lib/locales/be.yml
27
28
  - lib/locales/bg.yml
28
29
  - lib/locales/bs.yml
29
30
  - lib/locales/ca.yml
@@ -53,6 +54,7 @@ files:
53
54
  - lib/locales/ta.yml
54
55
  - lib/locales/tr.yml
55
56
  - lib/locales/uk.yml
57
+ - lib/locales/vi.yml
56
58
  - lib/locales/zh-CN.yml
57
59
  - lib/locales/zh-HK.yml
58
60
  - lib/locales/zh-TW.yml
@@ -81,6 +83,7 @@ files:
81
83
  - lib/pagy/extras/headers.rb
82
84
  - lib/pagy/extras/i18n.rb
83
85
  - lib/pagy/extras/items.rb
86
+ - lib/pagy/extras/jsonapi.rb
84
87
  - lib/pagy/extras/materialize.rb
85
88
  - lib/pagy/extras/meilisearch.rb
86
89
  - lib/pagy/extras/metadata.rb
@@ -95,21 +98,6 @@ files:
95
98
  - lib/pagy/frontend.rb
96
99
  - lib/pagy/i18n.rb
97
100
  - lib/pagy/url_helpers.rb
98
- - lib/templates/bootstrap_nav.html.erb
99
- - lib/templates/bootstrap_nav.html.haml
100
- - lib/templates/bootstrap_nav.html.slim
101
- - lib/templates/bulma_nav.html.erb
102
- - lib/templates/bulma_nav.html.haml
103
- - lib/templates/bulma_nav.html.slim
104
- - lib/templates/foundation_nav.html.erb
105
- - lib/templates/foundation_nav.html.haml
106
- - lib/templates/foundation_nav.html.slim
107
- - lib/templates/nav.html.erb
108
- - lib/templates/nav.html.haml
109
- - lib/templates/nav.html.slim
110
- - lib/templates/uikit_nav.html.erb
111
- - lib/templates/uikit_nav.html.haml
112
- - lib/templates/uikit_nav.html.slim
113
101
  homepage: https://github.com/ddnexus/pagy
114
102
  licenses:
115
103
  - MIT
@@ -128,14 +116,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
116
  requirements:
129
117
  - - ">="
130
118
  - !ruby/object:Gem::Version
131
- version: '2.5'
119
+ version: '3.1'
132
120
  required_rubygems_version: !ruby/object:Gem::Requirement
133
121
  requirements:
134
122
  - - ">="
135
123
  - !ruby/object:Gem::Version
136
124
  version: '0'
137
125
  requirements: []
138
- rubygems_version: 3.2.33
126
+ rubygems_version: 3.5.3
139
127
  signing_key:
140
128
  specification_version: 4
141
129
  summary: The kick-ass pagination ruby gem
@@ -1,24 +0,0 @@
1
- <%#
2
- This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
3
- calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
4
-
5
- The link variable is set to a proc that returns the link tag.
6
- Usage: link.call( page_number [, text [, extra_attributes_string ]])
7
- -%>
8
- <% link = pagy_link_proc(pagy, link_extra: 'class="page-link"') -%>
9
- <%# -%><nav class="pagy-bootstrap-nav" role="navigation">
10
- <%# -%> <ul class="pagination">
11
- <% if pagy.prev -%> <li class="page-item prev"><%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"') %></li>
12
- <% else -%> <li class="page-item prev disabled"><a href="#" class="page-link"><%== pagy_t('pagy.nav.prev') %></a></li>
13
- <% end -%>
14
- <% pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] -%>
15
- <% if item.is_a?(Integer) -%> <li class="page-item"><%== link.call(item) %></li>
16
- <% elsif item.is_a?(String) -%> <li class="page-item active"><%== link.call(item) %></li>
17
- <% elsif item == :gap -%> <li class="page-item disabled gap"><a href="#" class="page-link"><%== pagy_t('pagy.nav.gap') %></a></li>
18
- <% end -%>
19
- <% end -%>
20
- <% if pagy.next -%> <li class="page-item next"><%== link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"') %></li>
21
- <% else -%> <li class="page-item next disabled"><a href="#" class="page-link"><%== pagy_t('pagy.nav.next') %></a></li>
22
- <% end -%>
23
- <%# -%> </ul>
24
- <%# -%></nav>
@@ -1,34 +0,0 @@
1
- -# This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
2
- -# calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
3
-
4
- -# The link variable is set to a proc that returns the link tag.
5
- -# Usage: link.call( page_number [, text [, extra_attributes_string ]])
6
-
7
- - link = pagy_link_proc(pagy, link_extra: 'class="page-link"')
8
-
9
- %nav.pagy-bootstrap-nav{:role => "navigation"}
10
-
11
- %ul.pagination
12
-
13
- - if pagy.prev
14
- %li.page-item.prev!= link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')
15
- - else
16
- %li.page-item.prev.disabled
17
- %a.page-link{:href => '#'}!= pagy_t('pagy.nav.prev')
18
-
19
- - pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
20
- - if item.is_a?(Integer) # page link
21
- %li.page-item!= link.call(item)
22
-
23
- - elsif item.is_a?(String) # current page
24
- %li.page-item.active!= link.call(item)
25
-
26
- - elsif item == :gap # page gap
27
- %li.page-item.disabled.gap
28
- %a.page-link{:href => "#"}!= pagy_t('pagy.nav.gap')
29
-
30
- - if pagy.next
31
- %li.page-item.next!= link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
32
- - else
33
- %li.page-item.next.disabled
34
- %a.page-link{:href => '#'}!= pagy_t('pagy.nav.next')
@@ -1,34 +0,0 @@
1
- / This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
2
- / calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
3
-
4
- / The link variable is set to a proc that returns the link tag.
5
- / Usage: link.call( page_number [, text [, extra_attributes_string ]])
6
-
7
- - link = pagy_link_proc(pagy, link_extra: 'class="page-link"')
8
-
9
- nav.pagy-bootstrap-nav role="navigation"
10
-
11
- ul.pagination
12
-
13
- - if pagy.prev
14
- li.page-item.prev == link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')
15
- - else
16
- li.page-item.prev.disabled
17
- a.page-link href="#" == pagy_t('pagy.nav.prev')
18
-
19
- - pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
20
- - if item.is_a?(Integer) # page link
21
- li.page-item == link.call(item)
22
-
23
- - elsif item.is_a?(String) # current page
24
- li.page-item.active == link.call(item)
25
-
26
- - elsif item == :gap # page gap
27
- li.page-item.disabled.gap
28
- a.page-link href="#" == pagy_t('pagy.nav.gap')
29
-
30
- - if pagy.next
31
- li.page-item.next == link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
32
- - else
33
- li.page-item.next.disabled
34
- a.page-link href="#" == pagy_t('pagy.nav.next')
@@ -1,24 +0,0 @@
1
- <%#
2
- This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
3
- calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
4
-
5
- The link variable is set to a proc that returns the link tag.
6
- Usage: link.call( page_number [, text [, extra_attributes_string ]])
7
- -%>
8
- <% link = pagy_link_proc(pagy) -%>
9
- <%# -%><nav class="pagy-bulma-nav pagination is-centered" role="navigation" aria-label="pagination">
10
- <% if pagy.prev -%> <%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'class="pagination-previous" aria-label="previous page"') %>
11
- <% else -%> <a class="pagination-previous" disabled><%== pagy_t('pagy.nav.prev') %></a>
12
- <% end -%>
13
- <% if pagy.next -%> <%== link.call(pagy.next, pagy_t('pagy.nav.next'), 'class="pagination-next" aria-label="next page"') %>
14
- <% else -%> <a class="pagination-next" disabled><%== pagy_t('pagy.nav.next') %></a>
15
- <% end -%>
16
- <%# -%> <ul class="pagination-list">
17
- <% pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] -%>
18
- <% if item.is_a?(Integer) -%> <li><%== link.call item, item, %(class="pagination-link" aria-label="goto page #{item}") %></li>
19
- <% elsif item.is_a?(String) -%> <li><%== link.call item, item, %(class="pagination-link is-current" aria-label="page #{item}" aria-current="page") %></li>
20
- <% elsif item == :gap -%> <li><span class="pagination-ellipsis"><%== pagy_t('pagy.nav.gap') %></span></li>
21
- <% end -%>
22
- <% end -%>
23
- <%# -%> </ul>
24
- <%# -%></nav>
@@ -1,32 +0,0 @@
1
- -# This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
2
- -# calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
3
-
4
- -# The link variable is set to a proc that returns the link tag.
5
- -# Usage: link.call( page_number [, text [, extra_attributes_string ]])
6
-
7
- - link = pagy_link_proc(pagy)
8
-
9
- %nav.pagy-bulma_nav.pagination.is-centered{:role => "navigation", "aria-label" => "pagination"}
10
-
11
- - if pagy.prev
12
- != link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'class="pagination-previous" aria-label="previous page"')
13
- - else
14
- %a.pagination-previous{:disabled => "disabled"}!= pagy_t('pagy.nav.prev')
15
-
16
- - if pagy.next
17
- != link.call(pagy.next, pagy_t('pagy.nav.next'), 'class="pagination-next" aria-label="next page"')
18
- - else
19
- %a.pagination-next{:disabled => "disabled"}!= pagy_t('pagy.nav.next')
20
-
21
- %ul.pagination-list
22
-
23
- - pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
24
- - if item.is_a?(Integer) # page link
25
- %li!= link.call item, item, %(class="pagination-link" aria-label="goto page #{item}")
26
-
27
- - elsif item.is_a?(String) # current page
28
- %li!= link.call item, item, %(class="pagination-link is-current" aria-label="page #{item}" aria-current="page")
29
-
30
- - elsif item == :gap # page gap
31
- %li
32
- %span.pagination-ellipsis!= pagy_t('pagy.nav.gap')
@@ -1,32 +0,0 @@
1
- / This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
2
- / calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
3
-
4
- / The link variable is set to a proc that returns the link tag.
5
- / Usage: link.call( page_number [, text [, extra_attributes_string ]])
6
-
7
- - link = pagy_link_proc(pagy)
8
-
9
- nav.pagy-bulma-nav.pagination.is-centered role="navigation" aria-label="pagination"
10
-
11
- - if pagy.prev
12
- == link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'class="pagination-previous" aria-label="previous page"')
13
- - else
14
- a.pagination-previous disabled="disabled" == pagy_t('pagy.nav.prev')
15
-
16
- - if pagy.next
17
- == link.call(pagy.next, pagy_t('pagy.nav.next'), 'class="pagination-next" aria-label="next page"')
18
- - else
19
- a.pagination-next disabled="disabled" == pagy_t('pagy.nav.next')
20
-
21
- ul.pagination-list
22
-
23
- - pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
24
- - if item.is_a?(Integer) # page link
25
- li == link.call item, item, %(class="pagination-link" aria-label="goto page #{item}")
26
-
27
- - elsif item.is_a?(String) # current page
28
- li == link.call item, item, %(class="pagination-link is-current" aria-label="page #{item}" aria-current="page")
29
-
30
- - elsif item == :gap # page gap
31
- li
32
- span.pagination-ellipsis == pagy_t('pagy.nav.gap')
@@ -1,24 +0,0 @@
1
- <%#
2
- This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
3
- calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
4
-
5
- The link variable is set to a proc that returns the link tag.
6
- Usage: link.call( page_number [, text [, extra_attributes_string ]])
7
- -%>
8
- <% link = pagy_link_proc(pagy) -%>
9
- <%# -%><nav class="pagy-foundation-nav" role="navigation" aria-label="Pagination">
10
- <%# -%> <ul class="pagination">
11
- <% if pagy.prev -%> <li class="prev"><%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"') %></li>
12
- <% else -%> <li class="prev disabled"><%== pagy_t('pagy.nav.prev') %></li>
13
- <% end -%>
14
- <% pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] -%>
15
- <% if item.is_a?(Integer) -%> <li><%== link.call(item) %></li>
16
- <% elsif item.is_a?(String) -%> <li class="current"><%= pagy.label_for(item) %></li>
17
- <% elsif item == :gap -%> <li class="ellipsis gap" aria-hidden="true"></li>
18
- <% end -%>
19
- <% end -%>
20
- <% if pagy.next -%> <li class="next"><%== link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"') %></li>
21
- <% else -%> <li class="next disabled"><%== pagy_t('pagy.nav.next') %></li>
22
- <% end -%>
23
- <%# -%> </ul>
24
- <%# -%></nav>
@@ -1,34 +0,0 @@
1
- -# This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
2
- -# calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
3
-
4
- -# The link variable is set to a proc that returns the link tag.
5
- -# Usage: link.call( page_number [, text [, extra_attributes_string ]])
6
-
7
- - link = pagy_link_proc(pagy)
8
-
9
- %nav.pagy-foundation-nav{"role" => "navigation", "aria-label" => "Pagination"}
10
-
11
- %ul.pagination
12
-
13
- - if pagy.prev
14
- %li.prev!= link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')
15
- - else
16
- %li.prev.disabled
17
- != pagy_t('pagy.nav.prev')
18
-
19
- - pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
20
- - if item.is_a?(Integer) # page link
21
- %li!= link.call(item)
22
-
23
- - elsif item.is_a?(String) # current page
24
- %li.current
25
- = pagy.label_for(item)
26
-
27
- - elsif item == :gap # page gap
28
- %li.ellipsis.gap{"aria-hidden" => true}
29
-
30
- - if pagy.next
31
- %li.next!= link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
32
- - else
33
- %li.next.disabled
34
- != pagy_t('pagy.nav.next')
@@ -1,34 +0,0 @@
1
- / This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
2
- / calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
3
-
4
- / The link variable is set to a proc that returns the link tag.
5
- / Usage: link.call( page_number [, text [, extra_attributes_string ]])
6
-
7
- - link = pagy_link_proc(pagy)
8
-
9
- nav.pagy-foundation-nav role="navigation" aria-label="Pagination"
10
-
11
- ul.pagination
12
-
13
- - if pagy.prev
14
- li.prev == link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')
15
- - else
16
- li.prev.disabled
17
- == pagy_t('pagy.nav.prev')
18
-
19
- - pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
20
- - if item.is_a?(Integer) # page link
21
- li == link.call(item)
22
-
23
- - elsif item.is_a?(String) # current page
24
- li.current
25
- = pagy.label_for(item)
26
-
27
- - elsif item == :gap # page gap
28
- li.ellipsis.gap aria-hidden="true"
29
-
30
- - if pagy.next
31
- li.next == link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
32
- - else
33
- li.next.disabled
34
- == pagy_t('pagy.nav.next')
@@ -1,22 +0,0 @@
1
- <%#
2
- This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
3
- calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
4
-
5
- The link variable is set to a proc that returns the link tag.
6
- Usage: link.call( page_number [, text [, extra_attributes_string ]])
7
- -%>
8
- <% link = pagy_link_proc(pagy) -%>
9
- <%# -%><nav class="pagy_nav pagination" role="navigation">
10
- <% if pagy.prev -%> <span class="page prev"><%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"') %></span>
11
- <% else -%> <span class="page prev disabled"><%== pagy_t('pagy.nav.prev') %></span>
12
- <% end -%>
13
- <% pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] -%>
14
- <% if item.is_a?(Integer) -%> <span class="page"><%== link.call(item) %></span>
15
- <% elsif item.is_a?(String) -%> <span class="page current"><%= item %></span>
16
- <% elsif item == :gap -%> <span class="page gap"><%== pagy_t('pagy.nav.gap') %></span>
17
- <% end -%>
18
- <% end -%>
19
- <% if pagy.next -%> <span class="page next"><%== link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"') %></span>
20
- <% else -%> <span class="page next disabled"><%== pagy_t('pagy.nav.next') %></span>
21
- <% end -%>
22
- <%# -%></nav>
@@ -1,30 +0,0 @@
1
- -# This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
2
- -# calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
3
-
4
- -# The link variable is set to a proc that returns the link tag.
5
- -# Usage: link.call( page_number [, text [, extra_attributes_string ]])
6
-
7
- - link = pagy_link_proc(pagy)
8
-
9
- %nav.pagy_nav.pagination{:role => "navigation"}
10
-
11
- - if pagy.prev
12
- %span.page.prev!= link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')
13
- - else
14
- %span.page.prev.disabled!= pagy_t('pagy.nav.prev')
15
-
16
- - pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
17
- - if item.is_a?(Integer) # page link
18
- %span.page
19
- != link.call(item)
20
-
21
- - elsif item.is_a?(String) # current page
22
- %span.page.current= item
23
-
24
- - elsif item == :gap # page gap
25
- %span.page.gap!= pagy_t('pagy.nav.gap')
26
-
27
- - if pagy.next
28
- %span.page.next!= link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
29
- - else
30
- %span.page.next.disabled!= pagy_t('pagy.nav.next')
@@ -1,29 +0,0 @@
1
- / This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
2
- / calls with the actual strings ("&lsaquo; Prev", "Next &rsaquo;", "&hellip;").
3
-
4
- / The link variable is set to a proc that returns the link tag.
5
- / Usage: link.call( page_number [, text [, extra_attributes_string ]])
6
-
7
- - link = pagy_link_proc(pagy)
8
-
9
- nav.pagy_nav.pagination role="navigation"
10
-
11
- - if pagy.prev
12
- span.page.prev ==> link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')
13
- - else
14
- span.page.prev.disabled ==> pagy_t('pagy.nav.prev')
15
-
16
- - pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
17
- - if item.is_a?(Integer) # page link
18
- span.page ==> link.call(item)
19
-
20
- - elsif item.is_a?(String) # current page
21
- span.page.current ==> item
22
-
23
- - elsif item == :gap # page gap
24
- span.page.gap ==> pagy_t('pagy.nav.gap')
25
-
26
- - if pagy.next
27
- span.page.next == link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
28
- - else
29
- span.page.next.disabled == pagy_t('pagy.nav.next')
@@ -1,15 +0,0 @@
1
- <% link = pagy_link_proc(pagy) -%>
2
- <%# -%> <ul class="uk-pagination uk-flex-center">
3
- <% if page.prev -%> <li><%== link.call(pagy.prev, "<span uk-pagination-previous>#{pagy_t('pagy.nav.prev')}</span>") %></li>
4
- <% else -%> <li class="uk-disabled"><a href="#"><span uk-pagination-previous><%== pagy_t('pagy.nav.prev') %></span></a></li>
5
- <% end -%>
6
- <% pagy.series.each do |item| -%>
7
- <% if item.is_a?(Integer) -%> <li><%== link.call(item) %></li>
8
- <% elsif item.is_a?(String) -%> <li class="uk-active"><span><%== pagy.label_for(item) %></span></li>
9
- <% elsif item == :gap -%> <li class="uk-disabled"><span><%== pagy_t('pagy.nav.gap') %></span></li>
10
- <% end -%>
11
- <% end -%>
12
- <% if pagy.next -%> <li><%== link.call(pagy.next, "<span uk-pagination-next>#{pagy_t('pagy.nav.next')}</span>") %></li>
13
- <% else -%> <li class="uk-disabled"><a href="#"><span uk-pagination-next><%== pagy_t('pagy.nav.next') %></span></a></li>
14
- <% end -%>
15
- <%# -%> </ul>
@@ -1,28 +0,0 @@
1
- - link = pagy_link_proc(pagy)
2
-
3
- %ul.uk-pagination.uk-flex-center
4
- - if page.prev
5
- %li!= link.call(pagy.prev, "<span uk-pagination-previous>#{pagy_t('pagy.nav.prev')}</span>")
6
- - else
7
- %li.uk-disabled
8
- %a{href: "#"}
9
- %span{"uk-pagination-previous" => ""}!= pagy_t('pagy.nav.prev')
10
-
11
- - pagy.series.each do |item|
12
- - if item.is_a?(Integer)
13
- %li!= link.call(item)
14
-
15
- - elsif item.is_a?(String)
16
- %li.uk-active
17
- %span!= pagy.label_for(item)
18
-
19
- - elsif item == :gap
20
- %li.uk-disabled
21
- %span!= pagy_t('pagy.nav.gap')
22
-
23
- - if pagy.next
24
- %li!= link.call(p_next, "<span uk-pagination-next>#{pagy_t('pagy.nav.next')}</span>")
25
- - else
26
- %li.uk-disabled
27
- %a{href: "#"}
28
- %span{"uk-pagination-next" => ""}!= pagy_t('pagy.nav.next')