pagy 0.8.0 → 0.8.1

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: ae2667539ba0f1f518150c750faee613c5a47a3dc2154d9fc5ccbdd243891fbf
4
- data.tar.gz: 4eea6d2bfaf058897bcc233f93ee7c8c43d29f139c374ed9e6fb5685f6e03258
3
+ metadata.gz: 9fc2f90371fc435135b19f4ee4be00d69cdf946cb925babfb6646b03306d62c5
4
+ data.tar.gz: fd07adf8fe473bc5e6aaf644a7d08fb1de9352b7aec204338cd11c26f610c12c
5
5
  SHA512:
6
- metadata.gz: 241dc6c9f6b1bcb69edf5294112f915866709ed338947f30ab96ff3be79d0ed677f4a0d41fd08d9ed05495cf661d054b52effaaa948120aa8fe9ffbc6b638ae6
7
- data.tar.gz: f90c99e9c32cc9e27314555f8f531eb598be43b4c26bb3038506127b73b918f95132b84fa3db688e85003e8addae6314cd55a274743a8f95d85cf6349e670f99
6
+ metadata.gz: bc0a479d3bd32c7f06814912d107079e1c31f1c73f3033a4d69566ade0b98339d5104371e3b59932dd00134605b6c2e46d1b6db89ba5ef88f060d81006519c87
7
+ data.tar.gz: 1aa594ad6986364960fe70df3cad7f41474e66f8b6fb9995d075195ea340661bc729c8b6459c9f8eed190fc7bb447d2b4456a09127fe74e255f7f7bec01c19fd
data/lib/pagy.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'pathname'
4
4
 
5
- class Pagy ; VERSION = '0.8.0'
5
+ class Pagy ; VERSION = '0.8.1'
6
6
 
7
7
  class OutOfRangeError < StandardError; end
8
8
 
@@ -10,7 +10,7 @@ class Pagy ; VERSION = '0.8.0'
10
10
  def self.root; Pathname.new(__FILE__).dirname end
11
11
 
12
12
  # default core vars
13
- VARS = { page:1, items:20, outset:0, size:[1,4,4,1], page_param: :page }
13
+ VARS = { page:1, items:20, outset:0, size:[1,4,4,1], page_param: :page, params: {} }
14
14
 
15
15
  # default I18n vars
16
16
  zero_one = [:zero, :one] ; I18N = { file: Pagy.root.join('locales', 'pagy.yml').to_s, plurals: -> (c) {(zero_one[c] || :other).to_s.freeze} }
data/lib/pagy/frontend.rb CHANGED
@@ -35,9 +35,9 @@ class Pagy
35
35
 
36
36
 
37
37
  # this works with all Rack-based frameworks (Sinatra, Padrino, Rails, ...)
38
- def pagy_url_for(page, page_param)
39
- params = request.GET.merge(page_param => page)
40
- "#{request.path}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}"
38
+ def pagy_url_for(page, pagy)
39
+ params = request.GET.merge(pagy.vars[:page_param] => page).merge!(pagy.vars[:params])
40
+ "#{request.path}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}#{pagy.vars[:anchor]}"
41
41
  end
42
42
 
43
43
 
@@ -50,7 +50,7 @@ class Pagy
50
50
  # returns a specialized proc to generate the HTML links
51
51
  def pagy_link_proc(pagy, lx=''.freeze) # "lx" means "link extra"
52
52
  p_prev, p_next, p_lx = pagy.prev, pagy.next, pagy.vars[:link_extra]
53
- a, b = %(<a href="#{pagy_url_for(MARKER, pagy.vars[:page_param])}"#{p_lx ? %( #{p_lx}) : ''.freeze}#{lx.empty? ? lx : %( #{lx})}).split(MARKER)
53
+ a, b = %(<a href="#{pagy_url_for(MARKER, pagy)}"#{p_lx ? %( #{p_lx}) : ''.freeze}#{lx.empty? ? lx : %( #{lx})}).split(MARKER)
54
54
  -> (n, text=n, x=''.freeze) { "#{a}#{n}#{b}#{ if n == p_prev ; ' rel="prev"'.freeze
55
55
  elsif n == p_next ; ' rel="next"'.freeze
56
56
  else ''.freeze end }#{x.empty? ? x : %( #{x})}>#{text}</a>" }
data/pagy.gemspec CHANGED
@@ -32,10 +32,10 @@ Gem::Specification.new do |s|
32
32
  s.add_development_dependency 'rubocop', '~> 0.55.0' # needs to be fixed since it constantly adds new cops
33
33
 
34
34
 
35
- s.post_install_message = <<EOM
35
+ s.post_install_message = <<END_OF_MESSAGE
36
36
  ******************************************************************************
37
37
  Pagy CHANGELOG: https://github.com/ddnexus/pagy/blob/master/CHANGELOG.md
38
38
  ******************************************************************************
39
- EOM
39
+ END_OF_MESSAGE
40
40
 
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis