will_paginate 3.1.3 → 3.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fef2cd8f47f945a1b5d7378a4c66ceba6dc49cdb
4
- data.tar.gz: af9aa669e248488ec198d5239172fcf08fead4a1
3
+ metadata.gz: 5b9c92a0ce3f9e697334ea1bf11c0b57bdfd9fe2
4
+ data.tar.gz: b2794b2de86ceaa34f86d06f2c1952484b5409f9
5
5
  SHA512:
6
- metadata.gz: ea9ced53320267da3646dad5102f408ed8cc5ad7d973f0a91893035d6ef671c1d57ab5b8793b6002d84ca71363618948718f3ee8cfdd4f3b01e0628eebb96434
7
- data.tar.gz: c0571c50659366d61692379a97fbaff6f012529f38dc617a5efba1a24a1d9a3a687e95777ef4da6c96b9f0f94ee8380d6ce80b62b8ce7a2b36d95fb66c352eb3
6
+ metadata.gz: fe7a7e48c35bda6cd6648f5243f3992ebe576f586afd5d140066fa05ecdd83862681245f44e554f5483e5dc4fe9f957e3b84b6208cc91a8e1dd1804c8593a49b
7
+ data.tar.gz: 5c388ced4fd0b8ad3da2ce6c5e9b2323b4cff1b950fdf3b35cc6e148b1e12509e8b6c0b83156b483d1a732ce4fe2497a4c09553b2650775cc922803699bf4347
@@ -38,9 +38,15 @@ module WillPaginate
38
38
  alias_method :status_code, :status_code_with_paginate
39
39
  end
40
40
  def status_code_with_paginate(exception = @exception)
41
- if exception.is_a?(WillPaginate::InvalidPage) or
42
- (exception.respond_to?(:original_exception) &&
43
- 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)
44
50
  Rack::Utils.status_code(:not_found)
45
51
  else
46
52
  original_method = method(:status_code_without_paginate)
@@ -2,7 +2,7 @@ module WillPaginate #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- TINY = 3
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -41,10 +41,10 @@ module WillPaginate
41
41
  protected
42
42
 
43
43
  def page_number(page)
44
- unless page == current_page
45
- link(page, page, :rel => rel_value(page))
46
- else
44
+ if page == current_page
47
45
  tag(:em, page, :class => 'current')
46
+ else
47
+ link(page, page, :rel => rel_value(page))
48
48
  end
49
49
  end
50
50
 
@@ -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
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.1.3
4
+ version: 3.1.5
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-21 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