kaminari 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kaminari might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.document +1 -4
- data/.gitignore +1 -0
- data/.travis.yml +23 -5
- data/CHANGELOG +33 -0
- data/Gemfile +1 -1
- data/README.rdoc +40 -22
- data/Rakefile +2 -2
- data/app/views/kaminari/_first_page.html.erb +1 -1
- data/app/views/kaminari/_first_page.html.haml +1 -1
- data/app/views/kaminari/_first_page.html.slim +1 -1
- data/app/views/kaminari/_gap.html.erb +1 -1
- data/app/views/kaminari/_gap.html.haml +1 -1
- data/app/views/kaminari/_gap.html.slim +1 -1
- data/app/views/kaminari/_last_page.html.erb +1 -1
- data/app/views/kaminari/_last_page.html.haml +1 -1
- data/app/views/kaminari/_last_page.html.slim +1 -1
- data/app/views/kaminari/_next_page.html.erb +1 -1
- data/app/views/kaminari/_next_page.html.haml +1 -1
- data/app/views/kaminari/_next_page.html.slim +1 -1
- data/app/views/kaminari/_prev_page.html.erb +1 -1
- data/app/views/kaminari/_prev_page.html.haml +1 -1
- data/app/views/kaminari/_prev_page.html.slim +1 -1
- data/gemfiles/active_record_30.gemfile +5 -3
- data/gemfiles/active_record_31.gemfile +3 -3
- data/gemfiles/active_record_32.gemfile +6 -3
- data/gemfiles/active_record_40.gemfile +7 -0
- data/gemfiles/active_record_edge.gemfile +11 -0
- data/gemfiles/data_mapper_12.gemfile +10 -7
- data/gemfiles/mongo_mapper.gemfile +4 -1
- data/gemfiles/mongoid_24.gemfile +1 -1
- data/gemfiles/mongoid_30.gemfile +7 -2
- data/gemfiles/mongoid_31.gemfile +12 -0
- data/gemfiles/sinatra_13.gemfile +15 -0
- data/gemfiles/sinatra_14.gemfile +15 -0
- data/kaminari.gemspec +4 -4
- data/lib/kaminari/config.rb +2 -0
- data/lib/kaminari/helpers/action_view_extension.rb +1 -2
- data/lib/kaminari/helpers/paginator.rb +23 -12
- data/lib/kaminari/helpers/sinatra_helpers.rb +7 -1
- data/lib/kaminari/helpers/tags.rb +1 -1
- data/lib/kaminari/models/active_record_model_extension.rb +7 -5
- data/lib/kaminari/models/active_record_relation_methods.rb +12 -10
- data/lib/kaminari/models/array_extension.rb +4 -6
- data/lib/kaminari/models/configuration_methods.rb +16 -2
- data/lib/kaminari/models/data_mapper_extension.rb +5 -2
- data/lib/kaminari/models/page_scope_methods.rb +32 -3
- data/lib/kaminari/models/plucky_criteria_methods.rb +2 -1
- data/lib/kaminari/version.rb +1 -1
- data/lib/kaminari.rb +5 -4
- data/spec/config/config_spec.rb +15 -0
- data/spec/fake_app/active_record/models.rb +8 -0
- data/spec/fake_app/rails_app.rb +1 -0
- data/spec/helpers/action_view_extension_spec.rb +2 -2
- data/spec/models/active_record/active_record_relation_methods_spec.rb +42 -1
- data/spec/models/active_record/scopes_spec.rb +79 -2
- data/spec/models/array_spec.rb +29 -0
- data/spec/models/configuration_methods_spec.rb +125 -0
- data/spec/models/data_mapper/data_mapper_spec.rb +52 -0
- data/spec/models/mongo_mapper/mongo_mapper_spec.rb +12 -0
- data/spec/models/mongoid/mongoid_spec.rb +16 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/spec_helper_for_sinatra.rb +2 -3
- data/spec/support/database_cleaner.rb +5 -2
- metadata +50 -73
- data/gemfiles/sinatra.gemfile +0 -10
- data/spec/models/active_record/default_per_page_spec.rb +0 -32
- data/spec/models/active_record/max_per_page_spec.rb +0 -32
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5b6445e79b7d22acadc130f9d6d1dd502b6a669d
|
4
|
+
data.tar.gz: 0d095f1cd3c31d7eab8acc0a832c7c1916267d99
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 69c51c0b94c98fa207bf505b96139c3b5baf79345dc49308c4a2dba12a310380d7e994507fef6919ec3e521b5ecaa6586c44abf3084a6c0bf88ce29847c5c2f2
|
7
|
+
data.tar.gz: cdd68849dea19237aca6fdc95c6b225592a9c6c00d3a837b41be8c947a95606854fb5790d4f26c70d09795df483783c654cb271f65f9d0a5452ff708bc58ed01
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.document
CHANGED
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,17 +1,35 @@
|
|
1
|
+
services: mongodb
|
2
|
+
|
1
3
|
script: "bundle exec rake spec"
|
2
4
|
|
3
5
|
rvm:
|
4
|
-
- 1.8.7
|
5
6
|
- 1.9.3
|
7
|
+
- 2.0.0
|
8
|
+
- rbx-19mode
|
6
9
|
|
7
10
|
gemfile:
|
11
|
+
- gemfiles/active_record_30.gemfile
|
12
|
+
- gemfiles/active_record_31.gemfile
|
8
13
|
- gemfiles/active_record_32.gemfile
|
14
|
+
- gemfiles/active_record_40.gemfile
|
15
|
+
- gemfiles/active_record_edge.gemfile
|
9
16
|
- gemfiles/data_mapper_12.gemfile
|
10
17
|
- gemfiles/mongo_mapper.gemfile
|
18
|
+
- gemfiles/mongoid_24.gemfile
|
11
19
|
- gemfiles/mongoid_30.gemfile
|
12
|
-
- gemfiles/
|
20
|
+
- gemfiles/mongoid_31.gemfile
|
21
|
+
- gemfiles/sinatra_13.gemfile
|
22
|
+
- gemfiles/sinatra_14.gemfile
|
13
23
|
|
14
24
|
matrix:
|
15
|
-
|
16
|
-
- rvm: 1.
|
17
|
-
gemfile: gemfiles/
|
25
|
+
allow_failures:
|
26
|
+
- rvm: 1.9.3
|
27
|
+
gemfile: gemfiles/active_record_edge.gemfile
|
28
|
+
- rvm: 2.0.0
|
29
|
+
gemfile: gemfiles/active_record_edge.gemfile
|
30
|
+
- rvm: rbx-19mode
|
31
|
+
gemfile: gemfiles/active_record_edge.gemfile
|
32
|
+
- rvm: rbx-19mode
|
33
|
+
gemfile: gemfiles/sinatra_13.gemfile
|
34
|
+
- rvm: rbx-19mode
|
35
|
+
gemfile: gemfiles/sinatra_14.gemfile
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,36 @@
|
|
1
|
+
== 0.15.0
|
2
|
+
|
3
|
+
* Allow count, total count to pass parameters to super #193 [bsimpson]
|
4
|
+
|
5
|
+
* Add `max_pages` and `max_pages_per` methods to limit displayed pages per
|
6
|
+
model or globally #301 [zpieslak]
|
7
|
+
|
8
|
+
* Add support for Sinatra views overrides (add app views paths) #332 [j15e]
|
9
|
+
|
10
|
+
* Fix wrong pagination when used with `padding` #359 [vladimir-vg, negipo]
|
11
|
+
|
12
|
+
* check for Hash in addition to OrderedHash, which seems to break in Rails 4,
|
13
|
+
for total_count #369 [aew]
|
14
|
+
|
15
|
+
* Make `to_s` in paginator threadsafe #374 [bf4]
|
16
|
+
|
17
|
+
* Fix Missing partial Error when 'paginate' called from different format
|
18
|
+
template #381 [joker1007]
|
19
|
+
|
20
|
+
* Add `PageScopeMethods#next_page`, `prev_page`, and `out_of_range?` [yuki24]
|
21
|
+
|
22
|
+
* Use html_safe in view partials instead of raw fixed #73 [zzak]
|
23
|
+
|
24
|
+
* Fix a bug that `PaginatableArray#total_pages` returns the wrong value #416 [yuki24]
|
25
|
+
|
26
|
+
* Make `num_pages` to return the same value as `total_pages` for backward compat [yuki24, eitoball]
|
27
|
+
|
28
|
+
* Change #page_entries_info to use model name #340, #348 [znz, eitoball]
|
29
|
+
|
30
|
+
* Change scope to class method #433 [kolodovskyy]
|
31
|
+
|
32
|
+
* Fix arity problem with Rails 4.1.0 #449 [bricker]
|
33
|
+
|
1
34
|
== 0.14.1
|
2
35
|
|
3
36
|
* Changed the default "truncation" String from "..." to … #264 [pjaspers]
|
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= Kaminari
|
1
|
+
= Kaminari {<img src="https://travis-ci.org/amatsuda/kaminari.png"/>}[http://travis-ci.org/amatsuda/kaminari] {<img src="https://codeclimate.com/github/amatsuda/kaminari.png" />}[https://codeclimate.com/github/amatsuda/kaminari]
|
2
2
|
|
3
3
|
A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for modern web app frameworks and ORMs
|
4
4
|
|
@@ -19,7 +19,7 @@ No special collection class or anything for the paginated values, instead using
|
|
19
19
|
As the whole pagination helper is basically just a collection of links and non-links, Kaminari renders each of them through its own partial template inside the Engine. So, you can easily modify their behaviour, style or whatever by overriding partial templates.
|
20
20
|
|
21
21
|
=== ORM & template engine agnostic
|
22
|
-
Kaminari supports multiple ORMs (ActiveRecord, Mongoid, MongoMapper) multiple web frameworks (Rails, Sinatra), and multiple template engines (ERB, Haml).
|
22
|
+
Kaminari supports multiple ORMs (ActiveRecord, DataMapper, Mongoid, MongoMapper) multiple web frameworks (Rails, Sinatra, Grape), and multiple template engines (ERB, Haml, Slim).
|
23
23
|
|
24
24
|
=== Modern
|
25
25
|
The pagination helper outputs the HTML5 <nav> tag by default. Plus, the helper supports Rails 3 unobtrusive Ajax.
|
@@ -27,9 +27,9 @@ The pagination helper outputs the HTML5 <nav> tag by default. Plus, the helper s
|
|
27
27
|
|
28
28
|
== Supported versions
|
29
29
|
|
30
|
-
* Ruby 1.8.7, 1.9.2, 1.9.3, 2.0 (trunk)
|
30
|
+
* Ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1 (trunk)
|
31
31
|
|
32
|
-
* Rails 3.0.x, 3.1, 3.2, 4.0 (edge)
|
32
|
+
* Rails 3.0.x, 3.1, 3.2, 4.0, 4.1 (edge)
|
33
33
|
|
34
34
|
* Haml 3+
|
35
35
|
|
@@ -63,9 +63,14 @@ Then bundle:
|
|
63
63
|
User.page(7).per(50)
|
64
64
|
Note that the +per+ scope is not directly defined on the models but is just a method defined on the page scope. This is absolutely reasonable because you will never actually use +per_page+ without specifying the +page+ number.
|
65
65
|
|
66
|
+
Keep in mind that +per+ utilizes internally +limit+ and so it will override any +limit+ that was set previously
|
67
|
+
User.count # => 1000
|
68
|
+
a = User.limit(5).count # => 5
|
69
|
+
b = a.page(1).per(20).size # => 20
|
70
|
+
|
66
71
|
* the +padding+ scope
|
67
72
|
|
68
|
-
Occasionally you need to
|
73
|
+
Occasionally you need to pad a number of records that is not a multiple of the page size.
|
69
74
|
User.page(7).per(50).padding(3)
|
70
75
|
Note that the +padding+ scope also is not directly defined on the models.
|
71
76
|
|
@@ -87,7 +92,7 @@ Run the following generator command, then edit the generated file.
|
|
87
92
|
|
88
93
|
* changing +page_method_name+
|
89
94
|
|
90
|
-
You can change the method name
|
95
|
+
You can change the method name +page+ to +bonzo+ or +plant+ or whatever you like, in order to play nice with existing +page+ method or association or scope or any other plugin that defines +page+ method on your models.
|
91
96
|
|
92
97
|
|
93
98
|
=== Configuring default +per_page+ value for each model
|
@@ -104,7 +109,7 @@ Run the following generator command, then edit the generated file.
|
|
104
109
|
* +max_paginates_per+
|
105
110
|
|
106
111
|
You can specify max +per_page+ value per each model using the following declarative DSL.
|
107
|
-
If the variable that specified via +per+ scope is more than this variable,
|
112
|
+
If the variable that specified via +per+ scope is more than this variable, +max_paginates_per+ is used instead of it. Default value is nil, which means you are not imposing any max +per_page+ value.
|
108
113
|
class User < ActiveRecord::Base
|
109
114
|
max_paginates_per 100
|
110
115
|
end
|
@@ -132,17 +137,17 @@ Run the following generator command, then edit the generated file.
|
|
132
137
|
<%= paginate @users %>
|
133
138
|
This would output several pagination links such as <tt>« First ‹ Prev ... 2 3 4 5 6 7 8 9 10 ... Next › Last »</tt>
|
134
139
|
|
135
|
-
*
|
140
|
+
* specifying the "inner window" size (4 by default)
|
136
141
|
|
137
142
|
<%= paginate @users, :window => 2 %>
|
138
143
|
This would output something like <tt>... 5 6 7 8 9 ...</tt> when 7 is the current page.
|
139
144
|
|
140
|
-
*
|
145
|
+
* specifying the "outer window" size (0 by default)
|
141
146
|
|
142
147
|
<%= paginate @users, :outer_window => 3 %>
|
143
148
|
This would output something like <tt>1 2 3 4 ...(snip)... 17 18 19 20</tt> while having 20 pages in total.
|
144
149
|
|
145
|
-
* outer window can be
|
150
|
+
* outer window can be separately specified by +left+, +right+ (0 by default)
|
146
151
|
|
147
152
|
<%= paginate @users, :left => 1, :right => 3 %>
|
148
153
|
This would output something like <tt>1 ...(snip)... 18 19 20</tt> while having 20 pages in total.
|
@@ -165,7 +170,7 @@ Run the following generator command, then edit the generated file.
|
|
165
170
|
* the +link_to_next_page+ and +link_to_previous_page+ helper method
|
166
171
|
|
167
172
|
<%= link_to_next_page @items, 'Next Page' %>
|
168
|
-
This simply renders a link to the next page. This would be helpful for creating
|
173
|
+
This simply renders a link to the next page. This would be helpful for creating a Twitter-like pagination feature.
|
169
174
|
|
170
175
|
* the +page_entries_info+ helper method
|
171
176
|
|
@@ -206,7 +211,7 @@ Kaminari includes a handy template generator.
|
|
206
211
|
* themes
|
207
212
|
|
208
213
|
The generator has the ability to fetch several sample template themes from
|
209
|
-
the external repository (https://github.com/amatsuda/kaminari_themes) in
|
214
|
+
the external repository (https://github.com/amatsuda/kaminari_themes) in
|
210
215
|
addition to the bundled "default" one, which will help you creating a nice
|
211
216
|
looking paginator.
|
212
217
|
% rails g kaminari:views THEME
|
@@ -223,7 +228,7 @@ Kaminari includes a handy template generator.
|
|
223
228
|
% mkdir my_custom_theme
|
224
229
|
% cp _*.html.* my_custom_theme/
|
225
230
|
|
226
|
-
Next reference that directory when calling the paginate method:
|
231
|
+
Next, reference that directory when calling the +paginate+ method:
|
227
232
|
|
228
233
|
<%= paginate @users, :theme => 'my_custom_theme' %>
|
229
234
|
|
@@ -238,22 +243,22 @@ However, the <tt>paginate</tt> helper doesn't automatically handle your Array ob
|
|
238
243
|
<tt>Kaminari::paginate_array</tt> method converts your Array object into a paginatable Array that accepts <tt>page</tt> method.
|
239
244
|
Kaminari.paginate_array(my_array_object).page(params[:page]).per(10)
|
240
245
|
|
241
|
-
You can specify the
|
246
|
+
You can specify the +total_count+ value through options Hash. This would be helpful when handling an Array-ish object that has a different +count+ value from actual +count+ such as RSolr search result or when you need to generate a custom pagination. For example:
|
242
247
|
Kaminari.paginate_array([], total_count: 145).page(params[:page]).per(10)
|
243
248
|
|
244
249
|
== Creating friendly URLs and caching
|
245
250
|
|
246
|
-
Because of the
|
251
|
+
Because of the +page+ parameter and Rails 3 routing, you can easily generate SEO and user-friendly URLs. For any resource you'd like to paginate, just add the following to your +routes.rb+:
|
247
252
|
|
248
253
|
resources :my_resources do
|
249
254
|
get 'page/:page', :action => :index, :on => :collection
|
250
255
|
end
|
251
256
|
|
252
|
-
This will create URLs like
|
257
|
+
This will create URLs like <tt>/my_resources/page/33</tt> instead of <tt>/my_resources?page=33</tt>. This is now a friendly URL, but it also has other added benefits...
|
253
258
|
|
254
|
-
Because the
|
259
|
+
Because the +page+ parameter is now a URL segment, we can leverage on Rails page caching[http://guides.rubyonrails.org/caching_with_rails.html#page-caching]!
|
255
260
|
|
256
|
-
NOTE: In this example, I've pointed the route to my
|
261
|
+
NOTE: In this example, I've pointed the route to my <tt>:index</tt> action. You may have defined a custom pagination action in your controller - you should point <tt>:action => :your_custom_action</tt> instead.
|
257
262
|
|
258
263
|
|
259
264
|
== Sinatra/Padrino support
|
@@ -277,9 +282,6 @@ Check out Kaminari recipes on the GitHub Wiki for more advanced tips and techniq
|
|
277
282
|
https://github.com/amatsuda/kaminari/wiki/Kaminari-recipes
|
278
283
|
|
279
284
|
|
280
|
-
== Build Status {<img src="https://secure.travis-ci.org/amatsuda/kaminari.png"/>}[http://travis-ci.org/amatsuda/kaminari]
|
281
|
-
|
282
|
-
|
283
285
|
== Questions, Feedback
|
284
286
|
|
285
287
|
Feel free to message me on Github (amatsuda) or Twitter (@a_matsuda) ☇☇☇ :)
|
@@ -287,7 +289,23 @@ Feel free to message me on Github (amatsuda) or Twitter (@a_matsuda) ☇☇☇
|
|
287
289
|
|
288
290
|
== Contributing to Kaminari
|
289
291
|
|
290
|
-
|
292
|
+
Fork, fix, then send a pull request.
|
293
|
+
|
294
|
+
To run the test suite locally against all supported frameworks:
|
295
|
+
|
296
|
+
% bundle install
|
297
|
+
% rake spec:all
|
298
|
+
|
299
|
+
To target the test suite against one framework:
|
300
|
+
|
301
|
+
% rake spec:active_record_40
|
302
|
+
|
303
|
+
You can find a list of supported spec tasks by running <tt>rake -T</tt>. You may also find it useful to run a specific test
|
304
|
+
for a specific framework. To do so, you'll have to first make sure you have bundled everything for that configuration,
|
305
|
+
then you can run the specific test:
|
306
|
+
|
307
|
+
% BUNDLE_GEMFILE='gemfiles/active_record_40.gemfile' bundle install
|
308
|
+
% BUNDLE_GEMFILE='gemfiles/active_record_40.gemfile' bundle exec rspec ./spec/requests/users_spec.rb
|
291
309
|
|
292
310
|
|
293
311
|
== Copyright
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ end
|
|
13
13
|
task :default => "spec:all"
|
14
14
|
|
15
15
|
namespace :spec do
|
16
|
-
%w(active_record_32 active_record_31 active_record_30 data_mapper_12 mongoid_30 mongoid_24 mongo_mapper
|
16
|
+
%w(active_record_edge active_record_40 active_record_32 active_record_31 active_record_30 data_mapper_12 mongoid_31 mongoid_30 mongoid_24 mongo_mapper sinatra_13 sinatra_14).each do |gemfile|
|
17
17
|
desc "Run Tests against #{gemfile}"
|
18
18
|
task gemfile do
|
19
19
|
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
|
@@ -23,7 +23,7 @@ namespace :spec do
|
|
23
23
|
|
24
24
|
desc "Run Tests against all ORMs"
|
25
25
|
task :all do
|
26
|
-
%w(active_record_32 active_record_31 active_record_30 data_mapper_12 mongoid_30 mongoid_24 mongo_mapper
|
26
|
+
%w(active_record_edge active_record_40 active_record_32 active_record_31 active_record_30 data_mapper_12 mongoid_31 mongoid_30 mongoid_24 mongo_mapper sinatra_13 sinatra_14).each do |gemfile|
|
27
27
|
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
|
28
28
|
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake spec"
|
29
29
|
end
|
@@ -7,5 +7,5 @@
|
|
7
7
|
remote: data-remote
|
8
8
|
-%>
|
9
9
|
<span class="first">
|
10
|
-
<%= link_to_unless current_page.first?,
|
10
|
+
<%= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, :remote => remote %>
|
11
11
|
</span>
|
@@ -6,4 +6,4 @@
|
|
6
6
|
-# per_page: number of items to fetch per page
|
7
7
|
-# remote: data-remote
|
8
8
|
%span.first
|
9
|
-
= link_to_unless current_page.first?,
|
9
|
+
= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, :remote => remote
|
@@ -6,5 +6,5 @@
|
|
6
6
|
per_page : number of items to fetch per page
|
7
7
|
remote : data-remote
|
8
8
|
span.first
|
9
|
-
== link_to_unless current_page.first?,
|
9
|
+
== link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, :remote => remote
|
10
10
|
'
|
@@ -6,4 +6,4 @@
|
|
6
6
|
-# per_page: number of items to fetch per page
|
7
7
|
-# remote: data-remote
|
8
8
|
%span.last
|
9
|
-
= link_to_unless current_page.last?,
|
9
|
+
= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote
|
@@ -6,5 +6,5 @@
|
|
6
6
|
per_page : number of items to fetch per page
|
7
7
|
remote : data-remote
|
8
8
|
span.last
|
9
|
-
== link_to_unless current_page.last?,
|
9
|
+
== link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote
|
10
10
|
'
|
@@ -7,5 +7,5 @@
|
|
7
7
|
remote: data-remote
|
8
8
|
-%>
|
9
9
|
<span class="next">
|
10
|
-
<%= link_to_unless current_page.last?,
|
10
|
+
<%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote %>
|
11
11
|
</span>
|
@@ -6,4 +6,4 @@
|
|
6
6
|
-# per_page: number of items to fetch per page
|
7
7
|
-# remote: data-remote
|
8
8
|
%span.next
|
9
|
-
= link_to_unless current_page.last?,
|
9
|
+
= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote
|
@@ -6,5 +6,5 @@
|
|
6
6
|
per_page : number of items to fetch per page
|
7
7
|
remote : data-remote
|
8
8
|
span.next
|
9
|
-
== link_to_unless current_page.last?,
|
9
|
+
== link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote
|
10
10
|
'
|
@@ -7,5 +7,5 @@
|
|
7
7
|
remote: data-remote
|
8
8
|
-%>
|
9
9
|
<span class="prev">
|
10
|
-
<%= link_to_unless current_page.first?,
|
10
|
+
<%= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote %>
|
11
11
|
</span>
|
@@ -6,4 +6,4 @@
|
|
6
6
|
-# per_page: number of items to fetch per page
|
7
7
|
-# remote: data-remote
|
8
8
|
%span.prev
|
9
|
-
= link_to_unless current_page.first?,
|
9
|
+
= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote
|
@@ -6,5 +6,5 @@
|
|
6
6
|
per_page : number of items to fetch per page
|
7
7
|
remote : data-remote
|
8
8
|
span.prev
|
9
|
-
== link_to_unless current_page.first?,
|
9
|
+
== link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote
|
10
10
|
'
|
@@ -1,7 +1,9 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'railties', '
|
4
|
-
gem 'activerecord', '
|
3
|
+
gem 'railties', '~> 3.0.20'
|
4
|
+
gem 'activerecord', '~> 3.0.20', :require => 'active_record'
|
5
5
|
gem 'rspec-rails', '>= 2.0'
|
6
|
+
gem 'nokogiri', '< 1.6'
|
7
|
+
gem 'capybara', '< 2.1'
|
6
8
|
|
7
9
|
gemspec :path => '../'
|
@@ -1,7 +1,7 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'railties', '
|
4
|
-
gem 'activerecord', '
|
3
|
+
gem 'railties', '~> 3.1.12'
|
4
|
+
gem 'activerecord', '~> 3.1.12', :require => 'active_record'
|
5
5
|
gem 'rspec-rails', '>= 2.0'
|
6
6
|
|
7
7
|
gemspec :path => '../'
|
@@ -1,7 +1,10 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'railties', '
|
4
|
-
gem 'activerecord', '
|
3
|
+
gem 'railties', '~> 3.2.3'
|
4
|
+
gem 'activerecord', '~> 3.2.3', :require => 'active_record'
|
5
5
|
gem 'rspec-rails', '>= 2.0'
|
6
|
+
gem 'nokogiri'
|
7
|
+
gem 'xpath'
|
8
|
+
gem 'mime-types'
|
6
9
|
|
7
10
|
gemspec :path => '../'
|
@@ -1,12 +1,15 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'railties', '>= 3.2.3'
|
4
|
-
gem 'dm-core', '
|
5
|
-
gem 'dm-migrations', '
|
6
|
-
gem 'dm-aggregates', '
|
7
|
-
gem 'dm-transactions', '
|
8
|
-
gem 'dm-active_model', '
|
9
|
-
gem 'dm-sqlite-adapter', '
|
4
|
+
gem 'dm-core', '~> 1.2.0'
|
5
|
+
gem 'dm-migrations', '~> 1.2.0'
|
6
|
+
gem 'dm-aggregates', '~> 1.2.0'
|
7
|
+
gem 'dm-transactions', '~> 1.2.0'
|
8
|
+
gem 'dm-active_model', '~> 1.2.1'
|
9
|
+
gem 'dm-sqlite-adapter', '~> 1.2.0'
|
10
10
|
gem 'rspec-rails', '>= 2.0'
|
11
|
+
gem 'nokogiri'
|
12
|
+
gem 'xpath'
|
13
|
+
gem 'mime-types'
|
11
14
|
|
12
15
|
gemspec :path => '../'
|
data/gemfiles/mongoid_24.gemfile
CHANGED
data/gemfiles/mongoid_30.gemfile
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gem 'railties', '>= 3.2.3'
|
4
|
-
gem 'mongoid', '
|
4
|
+
gem 'mongoid', '~> 3.0.0'
|
5
5
|
gem 'rspec-rails', '>= 2.0'
|
6
|
+
gem 'origin'
|
7
|
+
gem 'moped'
|
8
|
+
gem 'nokogiri'
|
9
|
+
gem 'xpath'
|
10
|
+
gem 'mime-types'
|
6
11
|
|
7
12
|
gemspec :path => '../'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'activerecord', '~> 3.2.3', :require => 'active_record'
|
4
|
+
gem 'railties', '~> 3.2.3'
|
5
|
+
gem 'rspec-rails', '>= 2.0'
|
6
|
+
gem 'sinatra', '~> 1.3.0'
|
7
|
+
gem 'tilt', '~> 1.3.0'
|
8
|
+
gem 'padrino-helpers', '~> 0.10.6'
|
9
|
+
gem 'rack-test', '>= 0'
|
10
|
+
gem 'sinatra-contrib', '~> 1.3.0'
|
11
|
+
gem 'nokogiri'
|
12
|
+
gem 'xpath'
|
13
|
+
gem 'mime-types'
|
14
|
+
|
15
|
+
gemspec :path => '../'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'activerecord', '~> 3.2.0', :require => 'active_record'
|
4
|
+
gem 'railties', '~> 3.2.3'
|
5
|
+
gem 'rspec-rails', '>= 2.0'
|
6
|
+
gem 'sinatra', '~> 1.4.0'
|
7
|
+
gem 'tilt', '~> 1.3.0'
|
8
|
+
gem 'padrino-helpers', '~> 0.11.3'
|
9
|
+
gem 'rack-test', '>= 0'
|
10
|
+
gem 'sinatra-contrib', '~> 1.4.0'
|
11
|
+
gem 'nokogiri'
|
12
|
+
gem 'xpath'
|
13
|
+
gem 'mime-types'
|
14
|
+
|
15
|
+
gemspec :path => '../'
|
data/kaminari.gemspec
CHANGED
@@ -6,11 +6,11 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = 'kaminari'
|
7
7
|
s.version = Kaminari::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ['Akira Matsuda']
|
9
|
+
s.authors = ['Akira Matsuda', 'Zachary Scott', 'Yuki Nishijima', 'Hiroshi Shibata']
|
10
10
|
s.email = ['ronnie@dio.jp']
|
11
11
|
s.homepage = 'https://github.com/amatsuda/kaminari'
|
12
|
-
s.summary = 'A pagination engine plugin for Rails 3 or other modern frameworks'
|
13
|
-
s.description = 'Kaminari is a Scope & Engine based, clean, powerful, agnostic, customizable and sophisticated paginator for Rails 3'
|
12
|
+
s.summary = 'A pagination engine plugin for Rails 3+ or other modern frameworks'
|
13
|
+
s.description = 'Kaminari is a Scope & Engine based, clean, powerful, agnostic, customizable and sophisticated paginator for Rails 3+'
|
14
14
|
|
15
15
|
s.rubyforge_project = 'kaminari'
|
16
16
|
|
@@ -31,6 +31,6 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_development_dependency 'rspec', ['>= 0']
|
32
32
|
s.add_development_dependency 'rr', ['>= 0']
|
33
33
|
s.add_development_dependency 'capybara', ['>= 1.0']
|
34
|
-
s.add_development_dependency 'database_cleaner', ['
|
34
|
+
s.add_development_dependency 'database_cleaner', ['~> 1.2.0']
|
35
35
|
s.add_development_dependency 'rdoc', ['>= 0']
|
36
36
|
end
|
data/lib/kaminari/config.rb
CHANGED
@@ -24,6 +24,7 @@ module Kaminari
|
|
24
24
|
config_accessor :left
|
25
25
|
config_accessor :right
|
26
26
|
config_accessor :page_method_name
|
27
|
+
config_accessor :max_pages
|
27
28
|
|
28
29
|
def param_name
|
29
30
|
config.param_name.respond_to?(:call) ? config.param_name.call : config.param_name
|
@@ -45,5 +46,6 @@ module Kaminari
|
|
45
46
|
config.right = 0
|
46
47
|
config.page_method_name = :page
|
47
48
|
config.param_name = :page
|
49
|
+
config.max_pages = nil
|
48
50
|
end
|
49
51
|
end
|