will_paginate 3.1.6 → 3.3.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.
- checksums.yaml +5 -5
- data/README.md +4 -5
- data/lib/will_paginate/active_record.rb +7 -11
- data/lib/will_paginate/deprecation.rb +2 -2
- data/lib/will_paginate/i18n.rb +3 -3
- data/lib/will_paginate/locale/en.yml +2 -0
- data/lib/will_paginate/mongoid.rb +2 -0
- data/lib/will_paginate/page_number.rb +7 -11
- data/lib/will_paginate/railtie.rb +3 -4
- data/lib/will_paginate/version.rb +2 -2
- data/lib/will_paginate/view_helpers/action_view.rb +2 -2
- data/lib/will_paginate/view_helpers/hanami.rb +41 -0
- data/lib/will_paginate/view_helpers/link_renderer.rb +7 -3
- data/spec/finders/active_record_spec.rb +10 -3
- data/spec/finders/activerecord_test_connector.rb +14 -1
- data/spec/finders/mongoid_spec.rb +2 -0
- data/spec/finders/sequel_spec.rb +7 -6
- data/spec/page_number_spec.rb +9 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/view_helpers/action_view_spec.rb +20 -8
- data/spec/view_helpers/view_example_group.rb +1 -1
- metadata +13 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a6263dfb6824224c74e2383ba39b7f35abe25288dfcdd89a3dbab6f2585eb91e
|
4
|
+
data.tar.gz: c26bb41e5bf140fd2564ed63fda7ed4822f3c126a6a3b3885b27e2585dbf3647
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f67913552fff8839f5de82d9e55c61ad69c1a57216da3d5d627aef77455ee32a03d2b8c2b732299b37481ea6e9fd72a5baa1432e1fe296e78fc06b6a46ee8e0
|
7
|
+
data.tar.gz: 8979fdd5d35ee416e4c607f759b8e868188b11bb2ca7540d982866e936168170519492a027fff90cb31db12fb758b144389691c9374acfd58fd1880105d2201c
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# will_paginate
|
2
2
|
|
3
|
-
will_paginate is a pagination library that integrates with Ruby on Rails, Sinatra, Merb, DataMapper and Sequel.
|
3
|
+
will_paginate is a pagination library that integrates with Ruby on Rails, Sinatra, Hanami::View, Merb, DataMapper and Sequel.
|
4
4
|
|
5
5
|
Installation:
|
6
6
|
|
@@ -16,10 +16,10 @@ See [installation instructions][install] on the wiki for more info.
|
|
16
16
|
|
17
17
|
``` ruby
|
18
18
|
## perform a paginated query:
|
19
|
-
@posts = Post.paginate(:
|
19
|
+
@posts = Post.paginate(page: params[:page])
|
20
20
|
|
21
21
|
# or, use an explicit "per page" limit:
|
22
|
-
Post.paginate(:
|
22
|
+
Post.paginate(page: params[:page], per_page: 30)
|
23
23
|
|
24
24
|
## render page links in the view:
|
25
25
|
<%= will_paginate @posts %>
|
@@ -49,13 +49,12 @@ Post.where(:published => true).paginate(:page => params[:page]).order('id DESC')
|
|
49
49
|
Post.page(params[:page]).order('created_at DESC')
|
50
50
|
```
|
51
51
|
|
52
|
-
See [the wiki][wiki] for more documentation. [
|
52
|
+
See [the wiki][wiki] for more documentation. [Report bugs][issues] on GitHub.
|
53
53
|
|
54
54
|
Happy paginating.
|
55
55
|
|
56
56
|
|
57
57
|
[wiki]: https://github.com/mislav/will_paginate/wiki
|
58
58
|
[install]: https://github.com/mislav/will_paginate/wiki/Installation "will_paginate installation"
|
59
|
-
[group]: http://groups.google.com/group/will_paginate "will_paginate discussion and support group"
|
60
59
|
[issues]: https://github.com/mislav/will_paginate/issues
|
61
60
|
[css]: http://mislav.github.io/will_paginate/
|
@@ -83,7 +83,10 @@ module WillPaginate
|
|
83
83
|
excluded = [:order, :limit, :offset, :reorder]
|
84
84
|
excluded << :includes unless eager_loading?
|
85
85
|
rel = self.except(*excluded)
|
86
|
-
column_name =
|
86
|
+
column_name = if rel.select_values.present?
|
87
|
+
select = rel.select_values.join(", ")
|
88
|
+
select if select !~ /[,*]/
|
89
|
+
end || :all
|
87
90
|
rel.count(column_name)
|
88
91
|
else
|
89
92
|
super(*args)
|
@@ -102,9 +105,7 @@ module WillPaginate
|
|
102
105
|
# overloaded to be pagination-aware
|
103
106
|
def empty?
|
104
107
|
if !loaded? and offset_value
|
105
|
-
|
106
|
-
result = result.size if result.respond_to?(:size) and !result.is_a?(Integer)
|
107
|
-
result <= offset_value
|
108
|
+
total_entries <= offset_value
|
108
109
|
else
|
109
110
|
super
|
110
111
|
end
|
@@ -136,13 +137,6 @@ module WillPaginate
|
|
136
137
|
other.total_entries = nil if defined? @total_entries_queried
|
137
138
|
other
|
138
139
|
end
|
139
|
-
|
140
|
-
def select_for_count(rel)
|
141
|
-
if rel.select_values.present?
|
142
|
-
select = rel.select_values.join(", ")
|
143
|
-
select if select !~ /[,*]/
|
144
|
-
end
|
145
|
-
end
|
146
140
|
end
|
147
141
|
|
148
142
|
module Pagination
|
@@ -216,6 +210,8 @@ module WillPaginate
|
|
216
210
|
WHERE rownum <= #{pager.offset + pager.per_page}
|
217
211
|
) WHERE rnum >= #{pager.offset}
|
218
212
|
SQL
|
213
|
+
elsif (self.connection.adapter_name =~ /^sqlserver/i)
|
214
|
+
query << " OFFSET #{pager.offset} ROWS FETCH NEXT #{pager.per_page} ROWS ONLY"
|
219
215
|
else
|
220
216
|
query << " LIMIT #{pager.per_page} OFFSET #{pager.offset}"
|
221
217
|
end
|
@@ -31,8 +31,8 @@ module WillPaginate::Deprecation
|
|
31
31
|
super
|
32
32
|
end
|
33
33
|
|
34
|
-
def deprecate_key(*keys)
|
35
|
-
message = block_given? ?
|
34
|
+
def deprecate_key(*keys, &block)
|
35
|
+
message = block_given? ? block : keys.pop
|
36
36
|
Array(keys).each { |key| @deprecated[key] = message }
|
37
37
|
end
|
38
38
|
|
data/lib/will_paginate/i18n.rb
CHANGED
@@ -8,11 +8,11 @@ module WillPaginate
|
|
8
8
|
Dir["#{locale_dir}/*.{rb,yml}"]
|
9
9
|
end
|
10
10
|
|
11
|
-
def will_paginate_translate(keys, options = {})
|
11
|
+
def will_paginate_translate(keys, options = {}, &block)
|
12
12
|
if defined? ::I18n
|
13
13
|
defaults = Array(keys).dup
|
14
|
-
defaults <<
|
15
|
-
::I18n.translate(defaults.shift, options.merge(:default => defaults, :scope => :will_paginate))
|
14
|
+
defaults << block if block_given?
|
15
|
+
::I18n.translate(defaults.shift, **options.merge(:default => defaults, :scope => :will_paginate))
|
16
16
|
else
|
17
17
|
key = Array === keys ? keys.first : keys
|
18
18
|
yield key, options
|
@@ -8,6 +8,8 @@ module WillPaginate
|
|
8
8
|
extend CollectionMethods
|
9
9
|
@current_page = WillPaginate::PageNumber(options[:page] || @current_page || 1)
|
10
10
|
@page_multiplier = current_page - 1
|
11
|
+
@total_entries = options.delete(:total_entries)
|
12
|
+
|
11
13
|
pp = (options[:per_page] || per_page || WillPaginate.per_page).to_i
|
12
14
|
limit(pp).skip(@page_multiplier * pp)
|
13
15
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'delegate'
|
2
1
|
require 'forwardable'
|
3
2
|
|
4
3
|
module WillPaginate
|
@@ -6,7 +5,7 @@ module WillPaginate
|
|
6
5
|
module InvalidPage; end
|
7
6
|
|
8
7
|
# integer representing a page number
|
9
|
-
class PageNumber <
|
8
|
+
class PageNumber < Numeric
|
10
9
|
# a value larger than this is not supported in SQL queries
|
11
10
|
BIGINT = 9223372036854775807
|
12
11
|
|
@@ -18,13 +17,17 @@ module WillPaginate
|
|
18
17
|
raise RangeError, "invalid #{name}: #{value.inspect}"
|
19
18
|
end
|
20
19
|
@name = name
|
21
|
-
|
20
|
+
@value = value
|
22
21
|
rescue ArgumentError, TypeError, RangeError => error
|
23
22
|
error.extend InvalidPage
|
24
23
|
raise error
|
25
24
|
end
|
26
25
|
|
27
|
-
|
26
|
+
def to_i
|
27
|
+
@value
|
28
|
+
end
|
29
|
+
|
30
|
+
def_delegators :@value, :coerce, :==, :<=>, :to_s, :+, :-, :*, :/, :to_json
|
28
31
|
|
29
32
|
def inspect
|
30
33
|
"#{@name} #{to_i}"
|
@@ -40,13 +43,6 @@ module WillPaginate
|
|
40
43
|
alias is_a? kind_of?
|
41
44
|
end
|
42
45
|
|
43
|
-
# Ultrahax: makes `Integer === current_page` checks pass
|
44
|
-
Numeric.extend Module.new {
|
45
|
-
def ===(obj)
|
46
|
-
obj.instance_of? PageNumber or super
|
47
|
-
end
|
48
|
-
}
|
49
|
-
|
50
46
|
# An idemptotent coercion method
|
51
47
|
def self.PageNumber(value, name = 'page')
|
52
48
|
case value
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'will_paginate'
|
2
1
|
require 'will_paginate/page_number'
|
3
2
|
require 'will_paginate/collection'
|
4
3
|
require 'will_paginate/i18n'
|
@@ -39,7 +38,7 @@ module WillPaginate
|
|
39
38
|
end
|
40
39
|
def status_code_with_paginate(exception = @exception)
|
41
40
|
actual_exception = if exception.respond_to?(:cause)
|
42
|
-
exception.cause
|
41
|
+
exception.cause || exception
|
43
42
|
elsif exception.respond_to?(:original_exception)
|
44
43
|
exception.original_exception
|
45
44
|
else
|
@@ -60,11 +59,11 @@ module WillPaginate
|
|
60
59
|
end
|
61
60
|
|
62
61
|
module ControllerRescuePatch
|
63
|
-
def rescue_from(*args, &block)
|
62
|
+
def rescue_from(*args, **kwargs, &block)
|
64
63
|
if idx = args.index(WillPaginate::InvalidPage)
|
65
64
|
args[idx] = args[idx].name
|
66
65
|
end
|
67
|
-
super(*args, &block)
|
66
|
+
super(*args, **kwargs, &block)
|
68
67
|
end
|
69
68
|
end
|
70
69
|
end
|
@@ -43,7 +43,7 @@ module WillPaginate
|
|
43
43
|
# Wrapper for rendering pagination links at both top and bottom of a block
|
44
44
|
# of content.
|
45
45
|
#
|
46
|
-
#
|
46
|
+
# <%= paginated_section @posts do %>
|
47
47
|
# <ol id="posts">
|
48
48
|
# <% for post in @posts %>
|
49
49
|
# <li> ... </li>
|
@@ -80,7 +80,7 @@ module WillPaginate
|
|
80
80
|
defaults = nil
|
81
81
|
key = keys
|
82
82
|
end
|
83
|
-
translate(key, options.merge(:default => defaults, :scope => :will_paginate))
|
83
|
+
translate(key, **options.merge(:default => defaults, :scope => :will_paginate))
|
84
84
|
else
|
85
85
|
super
|
86
86
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'hanami/view'
|
2
|
+
require 'will_paginate/view_helpers'
|
3
|
+
require 'will_paginate/view_helpers/link_renderer'
|
4
|
+
|
5
|
+
module WillPaginate
|
6
|
+
module Hanami
|
7
|
+
module Helpers
|
8
|
+
include ViewHelpers
|
9
|
+
|
10
|
+
def will_paginate(collection, options = {}) #:nodoc:
|
11
|
+
options = options.merge(:renderer => LinkRenderer) unless options[:renderer]
|
12
|
+
str = super(collection, options)
|
13
|
+
str && raw(str)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class LinkRenderer < ViewHelpers::LinkRenderer
|
18
|
+
protected
|
19
|
+
|
20
|
+
def url(page)
|
21
|
+
str = File.join(request_env['SCRIPT_NAME'].to_s, request_env['PATH_INFO'])
|
22
|
+
params = request_env['rack.request.query_hash'].merge(param_name.to_s => page.to_s)
|
23
|
+
params.update @options[:params] if @options[:params]
|
24
|
+
str << '?' << build_query(params)
|
25
|
+
end
|
26
|
+
|
27
|
+
def request_env
|
28
|
+
@template.params.env
|
29
|
+
end
|
30
|
+
|
31
|
+
def build_query(params)
|
32
|
+
Rack::Utils.build_nested_query params
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.included(base)
|
37
|
+
base.include Helpers
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -35,16 +35,20 @@ module WillPaginate
|
|
35
35
|
# Returns the subset of +options+ this instance was initialized with that
|
36
36
|
# represent HTML attributes for the container element of pagination links.
|
37
37
|
def container_attributes
|
38
|
-
@container_attributes ||=
|
38
|
+
@container_attributes ||= {
|
39
|
+
:role => 'navigation',
|
40
|
+
:"aria-label" => @template.will_paginate_translate(:container_aria_label) { 'Pagination' }
|
41
|
+
}.update @options.except(*(ViewHelpers.pagination_options.keys + [:renderer] - [:class]))
|
39
42
|
end
|
40
43
|
|
41
44
|
protected
|
42
45
|
|
43
46
|
def page_number(page)
|
47
|
+
aria_label = @template.will_paginate_translate(:page_aria_label, :page => page.to_i) { "Page #{page}" }
|
44
48
|
if page == current_page
|
45
|
-
tag(:em, page, :class => 'current')
|
49
|
+
tag(:em, page, :class => 'current', :"aria-label" => aria_label, :"aria-current" => 'page')
|
46
50
|
else
|
47
|
-
link(page, page, :rel => rel_value(page))
|
51
|
+
link(page, page, :rel => rel_value(page), :"aria-label" => aria_label)
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
@@ -163,6 +163,13 @@ describe WillPaginate::ActiveRecord do
|
|
163
163
|
topics.total_entries.should == 999
|
164
164
|
end
|
165
165
|
|
166
|
+
it "overrides empty? count call with a total_entries fixed value" do
|
167
|
+
lambda {
|
168
|
+
topics = Topic.paginate :page => 1, :per_page => 3, :total_entries => 999
|
169
|
+
topics.should_not be_empty
|
170
|
+
}.should run_queries(0)
|
171
|
+
end
|
172
|
+
|
166
173
|
it "removes :include for count" do
|
167
174
|
lambda {
|
168
175
|
developers = Developer.paginate(:page => 1, :per_page => 1).includes(:projects)
|
@@ -213,7 +220,7 @@ describe WillPaginate::ActiveRecord do
|
|
213
220
|
sql = "select content from topics where content like '%futurama%'"
|
214
221
|
topics = Topic.paginate_by_sql sql, :page => 1, :per_page => 1
|
215
222
|
topics.total_entries.should == 1
|
216
|
-
topics.first.attributes.has_key?('title').should
|
223
|
+
topics.first.attributes.has_key?('title').should be(false)
|
217
224
|
}.should run_queries(2)
|
218
225
|
end
|
219
226
|
|
@@ -271,12 +278,12 @@ describe WillPaginate::ActiveRecord do
|
|
271
278
|
}.should run_queries(1)
|
272
279
|
end
|
273
280
|
|
274
|
-
it "should get second (inexistent) page of Topics, requiring
|
281
|
+
it "should get second (inexistent) page of Topics, requiring 1 query" do
|
275
282
|
lambda {
|
276
283
|
result = Topic.paginate :page => 2
|
277
284
|
result.total_pages.should == 1
|
278
285
|
result.should be_empty
|
279
|
-
}.should run_queries(
|
286
|
+
}.should run_queries(1)
|
280
287
|
end
|
281
288
|
|
282
289
|
describe "associations" do
|
@@ -79,6 +79,13 @@ module ActiverecordTestConnector
|
|
79
79
|
ActiveRecord::Base.configurations = { db => configuration }
|
80
80
|
ActiveRecord::Base.establish_connection(db.to_sym)
|
81
81
|
ActiveRecord::Base.default_timezone = :utc
|
82
|
+
|
83
|
+
case configuration['adapter']
|
84
|
+
when 'mysql'
|
85
|
+
fix_primary_key(ActiveRecord::ConnectionAdapters::MysqlAdapter)
|
86
|
+
when 'mysql2'
|
87
|
+
fix_primary_key(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
|
88
|
+
end
|
82
89
|
end
|
83
90
|
|
84
91
|
def load_schema
|
@@ -90,7 +97,13 @@ module ActiverecordTestConnector
|
|
90
97
|
$stdout = STDOUT
|
91
98
|
end
|
92
99
|
end
|
93
|
-
|
100
|
+
|
101
|
+
def fix_primary_key(adapter_class)
|
102
|
+
if ActiveRecord::VERSION::STRING < "4.1"
|
103
|
+
adapter_class::NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
94
107
|
module FixtureSetup
|
95
108
|
def fixtures(*tables)
|
96
109
|
table_names = tables.map { |t| t.to_s }
|
@@ -10,6 +10,8 @@ if !ENV['SKIP_NONRAILS_TESTS']
|
|
10
10
|
require 'will_paginate/mongoid'
|
11
11
|
Object.send(:const_set, :Rails, old_rails) if old_rails
|
12
12
|
|
13
|
+
Mongo::Logger.logger.level = Logger::INFO
|
14
|
+
|
13
15
|
Mongoid.connect_to 'will_paginate_test'
|
14
16
|
class MongoidModel
|
15
17
|
include Mongoid::Document
|
data/spec/finders/sequel_spec.rb
CHANGED
@@ -11,14 +11,15 @@ end
|
|
11
11
|
describe Sequel::Dataset::Pagination, 'extension' do
|
12
12
|
|
13
13
|
class Car < Sequel::Model
|
14
|
+
self.dataset = dataset.extension(:pagination)
|
14
15
|
end
|
15
16
|
|
16
17
|
it "should have the #paginate method" do
|
17
|
-
Car.should respond_to(:paginate)
|
18
|
+
Car.dataset.should respond_to(:paginate)
|
18
19
|
end
|
19
20
|
|
20
21
|
it "should NOT have the #paginate_by_sql method" do
|
21
|
-
Car.should_not respond_to(:paginate_by_sql)
|
22
|
+
Car.dataset.should_not respond_to(:paginate_by_sql)
|
22
23
|
end
|
23
24
|
|
24
25
|
describe 'pagination' do
|
@@ -29,7 +30,7 @@ describe Sequel::Dataset::Pagination, 'extension' do
|
|
29
30
|
end
|
30
31
|
|
31
32
|
it "should imitate WillPaginate::Collection" do
|
32
|
-
result = Car.paginate(1, 2)
|
33
|
+
result = Car.dataset.paginate(1, 2)
|
33
34
|
|
34
35
|
result.should_not be_empty
|
35
36
|
result.size.should == 2
|
@@ -41,16 +42,16 @@ describe Sequel::Dataset::Pagination, 'extension' do
|
|
41
42
|
end
|
42
43
|
|
43
44
|
it "should perform" do
|
44
|
-
Car.paginate(1, 2).all.should == [Car[1], Car[2]]
|
45
|
+
Car.dataset.paginate(1, 2).all.should == [Car[1], Car[2]]
|
45
46
|
end
|
46
47
|
|
47
48
|
it "should be empty" do
|
48
|
-
result = Car.paginate(3, 2)
|
49
|
+
result = Car.dataset.paginate(3, 2)
|
49
50
|
result.should be_empty
|
50
51
|
end
|
51
52
|
|
52
53
|
it "should perform with #select and #order" do
|
53
|
-
result = Car.select("name as foo"
|
54
|
+
result = Car.select(Sequel.lit("name as foo")).order(:name).paginate(1, 2).all
|
54
55
|
result.size.should == 2
|
55
56
|
result.first.values[:foo].should == "Aston Martin"
|
56
57
|
end
|
data/spec/page_number_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'will_paginate/page_number'
|
3
|
+
require 'json'
|
3
4
|
|
4
5
|
describe WillPaginate::PageNumber do
|
5
6
|
describe "valid" do
|
@@ -37,7 +38,14 @@ describe WillPaginate::PageNumber do
|
|
37
38
|
|
38
39
|
it "passes the Numeric=== type check" do |variable|
|
39
40
|
(Numeric === num).should be
|
40
|
-
|
41
|
+
end
|
42
|
+
|
43
|
+
it "fails the Numeric=== type check" do |variable|
|
44
|
+
(Integer === num).should_not be
|
45
|
+
end
|
46
|
+
|
47
|
+
it "serializes as JSON number" do
|
48
|
+
JSON.dump(page: num).should eq('{"page":12}')
|
41
49
|
end
|
42
50
|
end
|
43
51
|
|
data/spec/spec_helper.rb
CHANGED
@@ -14,7 +14,8 @@ Routes.draw do
|
|
14
14
|
get 'ibocorp(/:page)' => 'ibocorp#index',
|
15
15
|
:constraints => { :page => /\d+/ }, :defaults => { :page => 1 }
|
16
16
|
|
17
|
-
get '
|
17
|
+
get 'foo/bar' => 'foo#bar'
|
18
|
+
get 'baz/list' => 'baz#list'
|
18
19
|
end
|
19
20
|
|
20
21
|
describe WillPaginate::ActionView do
|
@@ -38,7 +39,14 @@ describe WillPaginate::ActionView do
|
|
38
39
|
attr_reader :assigns, :controller, :request
|
39
40
|
|
40
41
|
def render(locals)
|
41
|
-
|
42
|
+
lookup_context = []
|
43
|
+
if defined? ActionView::LookupContext
|
44
|
+
lookup_context = ActionView::LookupContext.new(lookup_context)
|
45
|
+
end
|
46
|
+
|
47
|
+
klass = ActionView::Base
|
48
|
+
klass = klass.with_empty_template_cache if klass.respond_to?(:with_empty_template_cache)
|
49
|
+
@view = klass.new(lookup_context, @assigns, @controller)
|
42
50
|
@view.request = @request
|
43
51
|
@view.singleton_class.send(:include, @controller._routes.url_helpers)
|
44
52
|
@view.render(:inline => @template, :locals => locals)
|
@@ -120,16 +128,20 @@ describe WillPaginate::ActionView do
|
|
120
128
|
it "should match expected markup" do
|
121
129
|
paginate
|
122
130
|
expected = <<-HTML
|
123
|
-
<div class="pagination"><span class="previous_page disabled">← Previous</span>
|
124
|
-
<em class="current">1</em>
|
125
|
-
<a href="/foo/bar?page=2" rel="next">2</a>
|
126
|
-
<a href="/foo/bar?page=3">3</a>
|
131
|
+
<div class="pagination" role="navigation" aria-label="Pagination"><span class="previous_page disabled">← Previous</span>
|
132
|
+
<em class="current" aria-label="Page 1" aria-current="page">1</em>
|
133
|
+
<a href="/foo/bar?page=2" aria-label="Page 2" rel="next">2</a>
|
134
|
+
<a href="/foo/bar?page=3" aria-label="Page 3">3</a>
|
127
135
|
<a href="/foo/bar?page=2" class="next_page" rel="next">Next →</a></div>
|
128
136
|
HTML
|
129
137
|
expected.strip!.gsub!(/\s{2,}/, ' ')
|
130
|
-
expected_dom = parse_html_document(expected)
|
138
|
+
expected_dom = parse_html_document(expected)
|
131
139
|
|
132
|
-
|
140
|
+
if expected_dom.respond_to?(:canonicalize)
|
141
|
+
html_document.canonicalize.should == expected_dom.canonicalize
|
142
|
+
else
|
143
|
+
html_document.root.should == expected_dom.root
|
144
|
+
end
|
133
145
|
end
|
134
146
|
|
135
147
|
it "should output escaped URLs" do
|
@@ -50,7 +50,7 @@ module ViewExampleGroup
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def parse_html_document(html)
|
53
|
-
|
53
|
+
if defined?(Rails::Dom::Testing::Assertions)
|
54
54
|
Nokogiri::HTML::Document.parse(html)
|
55
55
|
else
|
56
56
|
HTML::Document.new(html, true, false)
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: will_paginate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mislav Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-26 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
|
15
|
-
links in Rails, Sinatra and Merb web apps.
|
15
|
+
links in Rails, Sinatra, Hanami, and Merb web apps.
|
16
16
|
email: mislav.marohnic@gmail.com
|
17
17
|
executables: []
|
18
18
|
extensions: []
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/will_paginate/version.rb
|
40
40
|
- lib/will_paginate/view_helpers.rb
|
41
41
|
- lib/will_paginate/view_helpers/action_view.rb
|
42
|
+
- lib/will_paginate/view_helpers/hanami.rb
|
42
43
|
- lib/will_paginate/view_helpers/link_renderer.rb
|
43
44
|
- lib/will_paginate/view_helpers/link_renderer_base.rb
|
44
45
|
- lib/will_paginate/view_helpers/merb.rb
|
@@ -77,10 +78,15 @@ files:
|
|
77
78
|
- spec/view_helpers/base_spec.rb
|
78
79
|
- spec/view_helpers/link_renderer_base_spec.rb
|
79
80
|
- spec/view_helpers/view_example_group.rb
|
80
|
-
homepage: https://github.com/mislav/will_paginate
|
81
|
+
homepage: https://github.com/mislav/will_paginate
|
81
82
|
licenses:
|
82
83
|
- MIT
|
83
|
-
metadata:
|
84
|
+
metadata:
|
85
|
+
bug_tracker_uri: https://github.com/mislav/will_paginate/issues
|
86
|
+
changelog_uri: https://github.com/mislav/will_paginate/releases/tag/v3.3.0
|
87
|
+
documentation_uri: https://www.rubydoc.info/gems/will_paginate/3.3.0
|
88
|
+
source_code_uri: https://github.com/mislav/will_paginate/tree/v3.3.0
|
89
|
+
wiki_uri: https://github.com/mislav/will_paginate/wiki
|
84
90
|
post_install_message:
|
85
91
|
rdoc_options:
|
86
92
|
- "--main"
|
@@ -92,15 +98,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
98
|
requirements:
|
93
99
|
- - ">="
|
94
100
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0'
|
101
|
+
version: '2.0'
|
96
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
103
|
requirements:
|
98
104
|
- - ">="
|
99
105
|
- !ruby/object:Gem::Version
|
100
106
|
version: '0'
|
101
107
|
requirements: []
|
102
|
-
|
103
|
-
rubygems_version: 2.4.5.1
|
108
|
+
rubygems_version: 3.1.2
|
104
109
|
signing_key:
|
105
110
|
specification_version: 4
|
106
111
|
summary: Pagination plugin for web frameworks and other apps
|