will_paginate 3.0.8 → 3.0.12
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.
- checksums.yaml +4 -4
- data/lib/will_paginate/railtie.rb +13 -9
- data/lib/will_paginate/version.rb +1 -1
- data/lib/will_paginate/view_helpers/action_view.rb +1 -1
- data/lib/will_paginate/view_helpers/link_renderer.rb +1 -2
- data/lib/will_paginate/view_helpers/link_renderer_base.rb +1 -1
- data/spec/view_helpers/action_view_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70f44a0574db4ec78958041e6299452b35c6e4bf
|
4
|
+
data.tar.gz: 165a02112371349602d70cca5ce0d5c583e802bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e994750be209050697215a4f92b952760ec1be7e1d1bb05afb5fed986e3a3adf6e7417804bc77eeb730a67958d0bb8e02409a072b2b59438bf6e86d4f07d16c
|
7
|
+
data.tar.gz: f7730e8cdf54c6e679cd74ef71c909768927be6ea5e38be32396e5df13fb954787b22b3faa323ef634b857dca1d7bdaa6ae7bab835736019457450cd7d694d78
|
@@ -18,8 +18,6 @@ module WillPaginate
|
|
18
18
|
require 'will_paginate/view_helpers/action_view'
|
19
19
|
end
|
20
20
|
|
21
|
-
self.class.add_locale_path config
|
22
|
-
|
23
21
|
# early access to ViewHelpers.pagination_options
|
24
22
|
require 'will_paginate/view_helpers'
|
25
23
|
end
|
@@ -31,10 +29,6 @@ module WillPaginate
|
|
31
29
|
ActionController::Base.extend ControllerRescuePatch
|
32
30
|
end
|
33
31
|
|
34
|
-
def self.add_locale_path(config)
|
35
|
-
config.i18n.load_path.unshift(*WillPaginate::I18n.load_path)
|
36
|
-
end
|
37
|
-
|
38
32
|
# Extending the exception handler middleware so it properly detects
|
39
33
|
# WillPaginate::InvalidPage regardless of it being a tag module.
|
40
34
|
module ShowExceptionsPatch
|
@@ -44,9 +38,15 @@ module WillPaginate
|
|
44
38
|
alias_method :status_code, :status_code_with_paginate
|
45
39
|
end
|
46
40
|
def status_code_with_paginate(exception = @exception)
|
47
|
-
if exception.
|
48
|
-
|
49
|
-
|
41
|
+
actual_exception = if exception.respond_to?(:cause)
|
42
|
+
exception.cause
|
43
|
+
elsif exception.respond_to?(:original_exception)
|
44
|
+
exception.original_exception
|
45
|
+
else
|
46
|
+
exception
|
47
|
+
end
|
48
|
+
|
49
|
+
if actual_exception.is_a?(WillPaginate::InvalidPage)
|
50
50
|
Rack::Utils.status_code(:not_found)
|
51
51
|
else
|
52
52
|
original_method = method(:status_code_without_paginate)
|
@@ -69,3 +69,7 @@ module WillPaginate
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
72
|
+
|
73
|
+
ActiveSupport.on_load :i18n do
|
74
|
+
I18n.load_path.concat(WillPaginate::I18n.load_path)
|
75
|
+
end
|
@@ -108,9 +108,8 @@ module WillPaginate
|
|
108
108
|
|
109
109
|
def rel_value(page)
|
110
110
|
case page
|
111
|
-
when @collection.current_page - 1; 'prev'
|
111
|
+
when @collection.current_page - 1; 'prev'
|
112
112
|
when @collection.current_page + 1; 'next'
|
113
|
-
when 1; 'start'
|
114
113
|
end
|
115
114
|
end
|
116
115
|
|
@@ -30,7 +30,7 @@ module WillPaginate
|
|
30
30
|
window_from = current_page - inner_window
|
31
31
|
window_to = current_page + inner_window
|
32
32
|
|
33
|
-
# adjust lower or upper limit if
|
33
|
+
# adjust lower or upper limit if either is out of bounds
|
34
34
|
if window_to > total_pages
|
35
35
|
window_from -= window_to - total_pages
|
36
36
|
window_to = total_pages
|
@@ -80,9 +80,9 @@ describe WillPaginate::ActionView do
|
|
80
80
|
validate_page_numbers [1,1,3,3], elements
|
81
81
|
# test rel attribute values:
|
82
82
|
text(elements[0]).should == 'Prev'
|
83
|
-
elements[0]['rel'].should == 'prev
|
83
|
+
elements[0]['rel'].should == 'prev'
|
84
84
|
text(elements[1]).should == '1'
|
85
|
-
elements[1]['rel'].should == 'prev
|
85
|
+
elements[1]['rel'].should == 'prev'
|
86
86
|
text(elements[3]).should == 'Next'
|
87
87
|
elements[3]['rel'].should == 'next'
|
88
88
|
end
|
@@ -203,7 +203,7 @@ describe WillPaginate::ActionView do
|
|
203
203
|
end
|
204
204
|
|
205
205
|
it "doesn't allow tampering with script_name" do
|
206
|
-
request.params :script_name => 'p0wned'
|
206
|
+
request.params :script_name => 'p0wned', :original_script_name => 'p0wned'
|
207
207
|
paginate
|
208
208
|
assert_links_match %r{^/foo/bar}
|
209
209
|
assert_no_links_match /p0wned/
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: will_paginate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mislav Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: will_paginate provides a simple API for performing paginated queries
|
14
14
|
with Active Record, DataMapper and Sequel, and includes helpers for rendering pagination
|