will_paginate 3.0.8 → 3.0.12

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
  SHA1:
3
- metadata.gz: 578bfcd70a16322ebd1801e1c4a8c76a4ed0a334
4
- data.tar.gz: 2cdd8ab00a1283414888adc8ed64bbd7446223cf
3
+ metadata.gz: 70f44a0574db4ec78958041e6299452b35c6e4bf
4
+ data.tar.gz: 165a02112371349602d70cca5ce0d5c583e802bb
5
5
  SHA512:
6
- metadata.gz: 36e1ec8a34231aefd0a13ccc77afc09951762eefba81c11fb23561ebdff6914dc941e04b0c5209444afa1893e70463dc137f4b8eb1c0e6337cf35182a88faded
7
- data.tar.gz: 2bb06f172cdbc858e2bbbbce3582757b0b2f1a65fdcae9be930b44a00551ecd64ceb585f43279f5ebf9989e0c406fc4aa3399c7f2b2536041b1e86949a5bbef7
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.is_a?(WillPaginate::InvalidPage) or
48
- (exception.respond_to?(:original_exception) &&
49
- exception.original_exception.is_a?(WillPaginate::InvalidPage))
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
@@ -2,7 +2,7 @@ module WillPaginate #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 8
5
+ TINY = 12
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -99,7 +99,7 @@ module WillPaginate
99
99
  class LinkRenderer < ViewHelpers::LinkRenderer
100
100
  protected
101
101
 
102
- GET_PARAMS_BLACKLIST = [:script_name]
102
+ GET_PARAMS_BLACKLIST = [:script_name, :original_script_name]
103
103
 
104
104
  def default_url_params
105
105
  {}
@@ -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' + (page == 1 ? ' start' : '')
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 other is out of bounds
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 start'
83
+ elements[0]['rel'].should == 'prev'
84
84
  text(elements[1]).should == '1'
85
- elements[1]['rel'].should == 'prev start'
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.8
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-09-20 00:00:00.000000000 Z
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