dm-pager 1.0.2 → 1.1.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.
- data/History.md +5 -0
- data/dm-pager.gemspec +3 -3
- data/lib/dm-pager/defaults.rb +4 -3
- data/lib/dm-pager/pager.rb +49 -48
- data/lib/dm-pager/pagination.rb +17 -14
- data/lib/dm-pager/version.rb +1 -1
- data/spec/unit/pager_spec.rb +45 -37
- metadata +29 -13
data/History.md
CHANGED
data/dm-pager.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{dm-pager}
|
5
|
-
s.version = "1.0
|
5
|
+
s.version = "1.1.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["TJ Holowaychuk"]
|
9
|
-
s.date = %q{2010-
|
9
|
+
s.date = %q{2010-03-08}
|
10
10
|
s.description = %q{DataMapper Pagination}
|
11
11
|
s.email = %q{tj@vision-media.ca}
|
12
12
|
s.extra_rdoc_files = ["lib/dm-pager.rb", "lib/dm-pager/defaults.rb", "lib/dm-pager/helpers.rb", "lib/dm-pager/helpers/rails.rb", "lib/dm-pager/pager.rb", "lib/dm-pager/pagination.rb", "lib/dm-pager/version.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Dm-pager", "--main", "Readme.md"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{dm-pager}
|
18
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.6}
|
19
19
|
s.summary = %q{DataMapper Pagination}
|
20
20
|
|
21
21
|
if s.respond_to? :specification_version then
|
data/lib/dm-pager/defaults.rb
CHANGED
@@ -10,7 +10,8 @@ module DataMapper
|
|
10
10
|
:next_text => 'Next',
|
11
11
|
:first_text => 'First',
|
12
12
|
:last_text => 'Last',
|
13
|
-
:more_text => '...'
|
13
|
+
:more_text => '...',
|
14
|
+
:page_param => :page
|
14
15
|
}
|
15
16
|
|
16
17
|
##
|
@@ -31,10 +32,10 @@ module DataMapper
|
|
31
32
|
#
|
32
33
|
# DataMapper::Pagination.defaults[:size] = 5
|
33
34
|
#
|
34
|
-
|
35
|
+
|
35
36
|
def self.defaults
|
36
37
|
@defaults
|
37
38
|
end
|
38
39
|
|
39
40
|
end
|
40
|
-
end
|
41
|
+
end
|
data/lib/dm-pager/pager.rb
CHANGED
@@ -1,52 +1,53 @@
|
|
1
1
|
|
2
2
|
module DataMapper
|
3
3
|
class Pager
|
4
|
-
|
4
|
+
|
5
5
|
##
|
6
6
|
# Total number of un-limited records.
|
7
|
-
|
8
|
-
attr_reader :total
|
9
|
-
|
7
|
+
|
8
|
+
attr_reader :total
|
9
|
+
|
10
10
|
##
|
11
11
|
# Records per page.
|
12
|
-
|
13
|
-
attr_reader :per_page
|
14
|
-
|
12
|
+
|
13
|
+
attr_reader :per_page
|
14
|
+
|
15
15
|
##
|
16
16
|
# Current page number.
|
17
|
-
|
17
|
+
|
18
18
|
attr_reader :current_page
|
19
|
-
|
19
|
+
|
20
20
|
##
|
21
21
|
# Previous page or nil when no previous page is available.
|
22
|
-
|
22
|
+
|
23
23
|
attr_reader :previous_page
|
24
|
-
|
24
|
+
|
25
25
|
##
|
26
26
|
# Next page or nil when no more pages are available.
|
27
|
-
|
27
|
+
|
28
28
|
attr_reader :next_page
|
29
|
-
|
29
|
+
|
30
30
|
##
|
31
31
|
# Total number of pages.
|
32
|
-
|
32
|
+
|
33
33
|
attr_reader :total_pages
|
34
|
-
|
34
|
+
|
35
35
|
##
|
36
36
|
# Initialize with _options_.
|
37
|
-
|
37
|
+
|
38
38
|
def initialize options = {}
|
39
|
+
@page_param = options.delete(:page_param) || :page
|
39
40
|
@total = options.delete :total
|
40
41
|
@per_page = options.delete :limit
|
41
|
-
@current_page = options.delete
|
42
|
+
@current_page = options.delete @page_param
|
42
43
|
@total_pages = total.quo(per_page).ceil
|
43
44
|
@next_page = current_page + 1 unless current_page >= total_pages
|
44
45
|
@previous_page = current_page - 1 unless current_page <= 1
|
45
46
|
end
|
46
|
-
|
47
|
+
|
47
48
|
##
|
48
49
|
# Render the pager with the given _uri_ and _options_.
|
49
|
-
#
|
50
|
+
#
|
50
51
|
# === Examples
|
51
52
|
#
|
52
53
|
# User.page(2).pager.to_html('/users')
|
@@ -56,7 +57,7 @@ module DataMapper
|
|
56
57
|
#
|
57
58
|
# :size Number of intermediate page number links to be shown; Defaults to 7
|
58
59
|
#
|
59
|
-
|
60
|
+
|
60
61
|
def to_html uri, options = {}
|
61
62
|
return unless total_pages > 1
|
62
63
|
@uri, @options = uri, options
|
@@ -73,36 +74,36 @@ module DataMapper
|
|
73
74
|
last_link,
|
74
75
|
'</ul>'].join
|
75
76
|
end
|
76
|
-
|
77
|
+
|
77
78
|
private
|
78
|
-
|
79
|
+
|
79
80
|
##
|
80
81
|
# Fetch _key_ from the options passed to #to_html, or
|
81
82
|
# its default value.
|
82
|
-
|
83
|
+
|
83
84
|
def option key
|
84
85
|
@options.fetch key, Pagination.defaults[key]
|
85
86
|
end
|
86
|
-
|
87
|
+
|
87
88
|
##
|
88
|
-
# Link to _page_ with optional anchor tag _contents_.
|
89
|
-
|
89
|
+
# Link to _page_ with optional anchor tag _contents_.
|
90
|
+
|
90
91
|
def link_to page, contents = nil
|
91
92
|
%(<a href="#{uri_for(page)}">#{contents || page}</a>)
|
92
93
|
end
|
93
|
-
|
94
|
+
|
94
95
|
##
|
95
96
|
# More pages indicator for _position_.
|
96
|
-
|
97
|
+
|
97
98
|
def more position
|
98
99
|
return '' if position == :before && (current_page <= 1 || first <= 1)
|
99
100
|
return '' if position == :after && (current_page >= total_pages || last >= total_pages)
|
100
101
|
li 'more', option(:more_text)
|
101
102
|
end
|
102
|
-
|
103
|
+
|
103
104
|
##
|
104
105
|
# Intermediate page links array.
|
105
|
-
|
106
|
+
|
106
107
|
def intermediate_links
|
107
108
|
(first..last).map do |page|
|
108
109
|
classes = ["page-#{page}"]
|
@@ -110,35 +111,35 @@ module DataMapper
|
|
110
111
|
li classes.join(' '), link_to(page)
|
111
112
|
end
|
112
113
|
end
|
113
|
-
|
114
|
+
|
114
115
|
##
|
115
116
|
# Previous link.
|
116
|
-
|
117
|
+
|
117
118
|
def previous_link
|
118
119
|
li 'previous jump', link_to(previous_page, option(:previous_text)) if previous_page
|
119
120
|
end
|
120
|
-
|
121
|
+
|
121
122
|
##
|
122
123
|
# Next link.
|
123
|
-
|
124
|
+
|
124
125
|
def next_link
|
125
126
|
li 'next jump', link_to(next_page, option(:next_text)) if next_page
|
126
127
|
end
|
127
|
-
|
128
|
+
|
128
129
|
##
|
129
130
|
# Last link.
|
130
|
-
|
131
|
+
|
131
132
|
def last_link
|
132
133
|
li 'last jump', link_to(total_pages, option(:last_text)) if next_page
|
133
134
|
end
|
134
|
-
|
135
|
+
|
135
136
|
##
|
136
137
|
# First link.
|
137
|
-
|
138
|
+
|
138
139
|
def first_link
|
139
140
|
li 'first jump', link_to(1, option(:first_text)) if previous_page
|
140
141
|
end
|
141
|
-
|
142
|
+
|
142
143
|
##
|
143
144
|
# Determine first intermediate page.
|
144
145
|
|
@@ -151,7 +152,7 @@ module DataMapper
|
|
151
152
|
first
|
152
153
|
end
|
153
154
|
end
|
154
|
-
|
155
|
+
|
155
156
|
##
|
156
157
|
# Determine last intermediate page.
|
157
158
|
|
@@ -164,14 +165,14 @@ module DataMapper
|
|
164
165
|
last
|
165
166
|
end
|
166
167
|
end
|
167
|
-
|
168
|
+
|
168
169
|
##
|
169
170
|
# Renders a <li> with the given _css_class_ and _contents_.
|
170
|
-
|
171
|
+
|
171
172
|
def li css_class = nil, contents = nil
|
172
173
|
"<li#{%( class="#{css_class}") if css_class}>#{contents}</li>\n"
|
173
174
|
end
|
174
|
-
|
175
|
+
|
175
176
|
##
|
176
177
|
# Uri for _page_. The following conversions are made
|
177
178
|
# to the _uri_ previously passed to #to_html:
|
@@ -183,11 +184,11 @@ module DataMapper
|
|
183
184
|
|
184
185
|
def uri_for page
|
185
186
|
case @uri
|
186
|
-
when /\
|
187
|
-
when /\?/ ; @uri += "
|
188
|
-
else ; @uri += "
|
187
|
+
when /\b#{@page_param}=/ ; @uri.gsub /\b#{@page_param}=\d+/, "#{@page_param}=#{page}"
|
188
|
+
when /\?/ ; @uri += "&#{@page_param}=#{page}"
|
189
|
+
else ; @uri += "?#{@page_param}=#{page}"
|
189
190
|
end
|
190
191
|
end
|
191
|
-
|
192
|
+
|
192
193
|
end
|
193
|
-
end
|
194
|
+
end
|
data/lib/dm-pager/pagination.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
|
2
2
|
module DataMapper
|
3
3
|
module Pagination
|
4
|
-
|
4
|
+
|
5
5
|
##
|
6
6
|
# DataMapper::Pager instance.
|
7
|
-
|
7
|
+
|
8
8
|
attr_accessor :pager
|
9
|
-
|
9
|
+
|
10
10
|
##
|
11
11
|
# Page collection by the _page_ number and _options_ provided.
|
12
12
|
#
|
13
|
-
# Since pagers will commonly be used with query strings, we
|
13
|
+
# Since pagers will commonly be used with query strings, we
|
14
14
|
# coerce all numeric strings such as '12' to their integer value 12.
|
15
15
|
# This is the case for _page_, :per_page, :page, etc.
|
16
16
|
#
|
@@ -19,21 +19,24 @@ module DataMapper
|
|
19
19
|
# :page Current page number
|
20
20
|
# :per_page Results per page; defaults to 6
|
21
21
|
# :order Defaults to [:id.desc]
|
22
|
+
# :page_param The paramter to use to encode the page. Default :page
|
22
23
|
#
|
23
24
|
# === Examples
|
24
|
-
#
|
25
|
+
#
|
25
26
|
# User.all.page
|
26
27
|
# User.all.page(2)
|
27
28
|
# User.all.page(2, :per_page => 5)
|
28
29
|
# User.all.page(:page => 2, :per_page => 5)
|
30
|
+
# User.all.page(:page => 2, :page_param => :user_page)
|
29
31
|
#
|
30
|
-
|
32
|
+
|
31
33
|
def page page = nil, options = {}
|
32
34
|
options, page = page, nil if page.is_a? Hash
|
33
|
-
|
34
|
-
options
|
35
|
+
page_param = pager_option(:page_param, options)
|
36
|
+
page ||= pager_option page_param, options
|
37
|
+
options.delete page_param
|
35
38
|
page = 1 unless (page = page.to_i) && page > 1
|
36
|
-
per_page
|
39
|
+
per_page = pager_option(:per_page, options).to_i
|
37
40
|
query = options.dup
|
38
41
|
collection = new_collection scoped_query(options = {
|
39
42
|
:limit => per_page,
|
@@ -41,22 +44,22 @@ module DataMapper
|
|
41
44
|
:order => [:id.desc]
|
42
45
|
}.merge(query))
|
43
46
|
query.delete :order
|
44
|
-
options.merge! :total => count(query),
|
47
|
+
options.merge! :total => count(query), page_param => page, :page_param => page_param
|
45
48
|
collection.pager = DataMapper::Pager.new options
|
46
49
|
collection
|
47
50
|
end
|
48
|
-
|
51
|
+
|
49
52
|
private
|
50
|
-
|
53
|
+
|
51
54
|
##
|
52
55
|
# Return value for _key_ from indifferent hash _options_.
|
53
|
-
#
|
56
|
+
#
|
54
57
|
# * Checks for sym key
|
55
58
|
# * Checks for string key
|
56
59
|
# * Checks DataMapper::Pagination.defaults for the sym key
|
57
60
|
# * Deletes both keys to prevent them from being part of the query
|
58
61
|
#
|
59
|
-
|
62
|
+
|
60
63
|
def pager_option key, options = {}
|
61
64
|
a = options.delete key.to_sym
|
62
65
|
b = options.delete key.to_s
|
data/lib/dm-pager/version.rb
CHANGED
data/spec/unit/pager_spec.rb
CHANGED
@@ -3,58 +3,66 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
3
3
|
|
4
4
|
describe DataMapper::Pager do
|
5
5
|
before(:each) { mock_items }
|
6
|
-
|
6
|
+
|
7
7
|
describe "#to_html" do
|
8
8
|
describe "when pages are available" do
|
9
9
|
it "should render a ul.pager wrapper" do
|
10
|
-
|
10
|
+
begin
|
11
|
+
Item.page.pager.to_html('/').should match(/ul class="([^"]+)?"/)
|
12
|
+
rescue =>e
|
13
|
+
puts e.class, e.message, e.backtrace.join("\n")
|
14
|
+
end
|
11
15
|
end
|
12
|
-
|
16
|
+
|
13
17
|
it "should render a ul containing intermediate items" do
|
14
18
|
Item.page.pager.to_html('/').should match(/<ul class="[^"]+?"><li/)
|
15
19
|
end
|
16
|
-
|
20
|
+
|
17
21
|
it "should add the 'active' class to the current page link <li>" do
|
18
22
|
Item.page.pager.to_html('/').should include('li class="page-1 active"><a href="/?page=1"')
|
19
23
|
Item.page(2).pager.to_html('/').should include('li class="page-2 active"><a href="/?page=2"')
|
20
24
|
Item.page(3).pager.to_html('/').should include('li class="page-3 active"><a href="/?page=3"')
|
21
25
|
end
|
22
|
-
|
26
|
+
|
23
27
|
it "should add li.last.jump" do
|
24
28
|
Item.page.pager.to_html('/').should include('<li class="last jump">')
|
25
29
|
end
|
26
|
-
|
30
|
+
|
27
31
|
it "should add li.first.jump" do
|
28
32
|
Item.page(2).pager.to_html('/').should include('<li class="first jump"')
|
29
33
|
end
|
30
|
-
|
34
|
+
|
31
35
|
it "should add li.next.jump" do
|
32
36
|
Item.page.pager.to_html('/').should include('<li class="next jump">')
|
33
37
|
end
|
34
|
-
|
38
|
+
|
35
39
|
it "should add li.previous.jump" do
|
36
40
|
Item.page(2).pager.to_html('/').should include('<li class="previous jump">')
|
37
41
|
end
|
42
|
+
|
43
|
+
it "should allow setting the paging parameter name" do
|
44
|
+
Item.page(2, :page_param => :hot_stuff).pager.to_html("/items").should include("href=\"/items?hot_stuff=2\"")
|
45
|
+
end
|
38
46
|
end
|
39
|
-
|
47
|
+
|
40
48
|
describe "when one page is available" do
|
41
49
|
it "should render nothing" do
|
42
50
|
Item.all(:id.lt => 2).page.pager.to_html('/').should be_nil
|
43
51
|
end
|
44
52
|
end
|
45
|
-
|
53
|
+
|
46
54
|
describe "when no pages are available" do
|
47
55
|
it "should render nothing" do
|
48
56
|
Item.all(:id.lt => 1).page.pager.to_html('/').should be_nil
|
49
57
|
end
|
50
58
|
end
|
51
|
-
|
59
|
+
|
52
60
|
describe "when on the first page" do
|
53
61
|
it "should not render the 'Previous' page link" do
|
54
62
|
markup = Item.page.pager.to_html('/')
|
55
63
|
markup.should_not include('Previous')
|
56
64
|
end
|
57
|
-
|
65
|
+
|
58
66
|
it "should render some intermediate page links with ... after" do
|
59
67
|
markup = Item.page.pager.to_html('/', :size => 3)
|
60
68
|
markup.should include('>1<')
|
@@ -63,28 +71,28 @@ describe DataMapper::Pager do
|
|
63
71
|
markup.should_not include('>4<')
|
64
72
|
markup.should include(%(<li class="more">...</li>\n<li class="next jump"))
|
65
73
|
end
|
66
|
-
|
74
|
+
|
67
75
|
it "should not render ... before" do
|
68
76
|
markup = Item.page.pager.to_html('/', :size => 3)
|
69
77
|
markup.should_not include('<a href="/?page=3" class="previous jump">Previous</a><li class="more">...</li>')
|
70
78
|
end
|
71
|
-
|
79
|
+
|
72
80
|
it "should not render the 'First' page link" do
|
73
81
|
markup = Item.page.pager.to_html('/')
|
74
82
|
markup.should_not include('First')
|
75
83
|
end
|
76
|
-
|
84
|
+
|
77
85
|
it "should render the 'Last' page link" do
|
78
86
|
markup = Item.page.pager.to_html('/')
|
79
87
|
markup.should include('Last')
|
80
88
|
end
|
81
89
|
end
|
82
|
-
|
90
|
+
|
83
91
|
describe "with the :size option set" do
|
84
92
|
it "should raise an error when given an even number" do
|
85
93
|
lambda { Item.page.pager.to_html('/', :size => 2) }.should raise_error(ArgumentError, /must be an odd number/)
|
86
94
|
end
|
87
|
-
|
95
|
+
|
88
96
|
it "should render only the specified number of intermediate page links" do
|
89
97
|
markup = Item.page.pager.to_html('/', :size => 3)
|
90
98
|
markup.should include('>1<')
|
@@ -93,7 +101,7 @@ describe DataMapper::Pager do
|
|
93
101
|
markup.should_not include('>4<')
|
94
102
|
end
|
95
103
|
end
|
96
|
-
|
104
|
+
|
97
105
|
[:first, :previous, :next, :last].each do |pos|
|
98
106
|
describe "with the #{pos.inspect} option set" do
|
99
107
|
it "should change the default contents for the '#{pos}' link" do
|
@@ -102,23 +110,23 @@ describe DataMapper::Pager do
|
|
102
110
|
end
|
103
111
|
end
|
104
112
|
end
|
105
|
-
|
113
|
+
|
106
114
|
describe "when on the last page" do
|
107
115
|
it "should not render the 'Next' page link" do
|
108
116
|
markup = Item.page(4).pager.to_html('/')
|
109
117
|
markup.should_not include('Next')
|
110
118
|
end
|
111
|
-
|
119
|
+
|
112
120
|
it "should not render the 'Last' page link" do
|
113
121
|
markup = Item.page(4).pager.to_html('/')
|
114
122
|
markup.should_not include('Last')
|
115
123
|
end
|
116
|
-
|
124
|
+
|
117
125
|
it "should render the 'First' page link" do
|
118
126
|
markup = Item.page(4).pager.to_html('/')
|
119
127
|
markup.should include('First')
|
120
128
|
end
|
121
|
-
|
129
|
+
|
122
130
|
it "should render some intermediate page links with ... before" do
|
123
131
|
markup = Item.page(4).pager.to_html('/', :size => 3)
|
124
132
|
markup.should include(%(<li class="previous jump"><a href="/?page=3">Previous</a></li>\n<li class="more">...<))
|
@@ -128,24 +136,24 @@ describe DataMapper::Pager do
|
|
128
136
|
markup.should include('>4<')
|
129
137
|
markup.should_not include('>5<')
|
130
138
|
end
|
131
|
-
|
139
|
+
|
132
140
|
it "should not render ... after" do
|
133
141
|
markup = Item.page(4).pager.to_html('/', :size => 3)
|
134
142
|
markup.should_not include(%(<li class="more">...</li>\n<a href="/?page=6" class="next jump"))
|
135
143
|
end
|
136
144
|
end
|
137
|
-
|
145
|
+
|
138
146
|
describe "when on an intermediate page" do
|
139
147
|
it "should render the 'Previous' page link" do
|
140
148
|
markup = Item.page(2).pager.to_html('/')
|
141
149
|
markup.should include('Previous')
|
142
150
|
end
|
143
|
-
|
151
|
+
|
144
152
|
it "should render the 'Next' page link" do
|
145
|
-
markup = Item.page(2).pager.to_html('/')
|
153
|
+
markup = Item.page(2).pager.to_html('/')
|
146
154
|
markup.should include('Next')
|
147
155
|
end
|
148
|
-
|
156
|
+
|
149
157
|
it "should render some intermediate page links with ... before and after" do
|
150
158
|
markup = Item.page(5, :per_page => 2).pager.to_html('/', :size => 3)
|
151
159
|
markup.should include(%(<li class="previous jump"><a href="/?page=4">Previous</a></li>\n<li class="more">...</li>))
|
@@ -156,18 +164,18 @@ describe DataMapper::Pager do
|
|
156
164
|
markup.should_not include('>7<')
|
157
165
|
markup.should include(%(<li class="more">...</li>\n<li class="next jump"))
|
158
166
|
end
|
159
|
-
|
167
|
+
|
160
168
|
it "should render the 'Last' page link" do
|
161
169
|
markup = Item.page(2).pager.to_html('/')
|
162
170
|
markup.should include('Last')
|
163
171
|
end
|
164
|
-
|
172
|
+
|
165
173
|
it "should render the 'First' page link" do
|
166
174
|
markup = Item.page(2).pager.to_html('/')
|
167
175
|
markup.should include('First')
|
168
176
|
end
|
169
177
|
end
|
170
|
-
|
178
|
+
|
171
179
|
describe "when on the second page" do
|
172
180
|
it "should render 1 through 3 when :size is 3 followed by ..." do
|
173
181
|
markup = Item.page(2, :per_page => 2).pager.to_html('/', :size => 3)
|
@@ -179,7 +187,7 @@ describe DataMapper::Pager do
|
|
179
187
|
markup.should include(%(<li class="more">...</li>\n<li class="next jump"))
|
180
188
|
end
|
181
189
|
end
|
182
|
-
|
190
|
+
|
183
191
|
describe "when on the second last page" do
|
184
192
|
it "should render 8 through 10 when :size is 3 with preceding ..." do
|
185
193
|
markup = Item.page(9, :per_page => 2).pager.to_html('/', :size => 3)
|
@@ -192,14 +200,14 @@ describe DataMapper::Pager do
|
|
192
200
|
markup.should_not include(%(<li class="more">...</li>\n<li class="next jump"))
|
193
201
|
end
|
194
202
|
end
|
195
|
-
|
203
|
+
|
196
204
|
describe "when passing a uri without a query string" do
|
197
205
|
it "should append a query string to each uri" do
|
198
206
|
markup = Item.page.pager.to_html 'items'
|
199
207
|
markup.should include('items?page=1')
|
200
208
|
end
|
201
209
|
end
|
202
|
-
|
210
|
+
|
203
211
|
describe "when passing a uri with a query string" do
|
204
212
|
describe "containing page=N" do
|
205
213
|
it "should alter the page value" do
|
@@ -207,14 +215,14 @@ describe DataMapper::Pager do
|
|
207
215
|
markup.should include('items?page=1')
|
208
216
|
end
|
209
217
|
end
|
210
|
-
|
218
|
+
|
211
219
|
describe "not containing page=N" do
|
212
220
|
it "should append a pair" do
|
213
221
|
markup = Item.page.pager.to_html 'items?foo=bar'
|
214
222
|
markup.should include('items?foo=bar&page=1')
|
215
223
|
end
|
216
224
|
end
|
217
|
-
|
225
|
+
|
218
226
|
describe "when containing other keys with 'page'" do
|
219
227
|
it "should append a pair" do
|
220
228
|
markup = Item.page.pager.to_html 'items?per_page=5'
|
@@ -224,6 +232,6 @@ describe DataMapper::Pager do
|
|
224
232
|
end
|
225
233
|
end
|
226
234
|
end
|
227
|
-
|
235
|
+
|
228
236
|
end
|
229
|
-
end
|
237
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-pager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 1.1.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- TJ Holowaychuk
|
@@ -9,29 +14,37 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-03-08 00:00:00 -08:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: dm-core
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 10
|
30
|
+
- 1
|
23
31
|
version: 0.10.1
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: dm-aggregates
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
38
|
requirements:
|
31
39
|
- - ">="
|
32
40
|
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
- 10
|
44
|
+
- 1
|
33
45
|
version: 0.10.1
|
34
|
-
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
35
48
|
description: DataMapper Pagination
|
36
49
|
email: tj@vision-media.ca
|
37
50
|
executables: []
|
@@ -89,18 +102,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
102
|
requirements:
|
90
103
|
- - ">="
|
91
104
|
- !ruby/object:Gem::Version
|
105
|
+
segments:
|
106
|
+
- 0
|
92
107
|
version: "0"
|
93
|
-
version:
|
94
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
109
|
requirements:
|
96
110
|
- - ">="
|
97
111
|
- !ruby/object:Gem::Version
|
112
|
+
segments:
|
113
|
+
- 1
|
114
|
+
- 2
|
98
115
|
version: "1.2"
|
99
|
-
version:
|
100
116
|
requirements: []
|
101
117
|
|
102
118
|
rubyforge_project: dm-pager
|
103
|
-
rubygems_version: 1.3.
|
119
|
+
rubygems_version: 1.3.6
|
104
120
|
signing_key:
|
105
121
|
specification_version: 3
|
106
122
|
summary: DataMapper Pagination
|