rails_pagination 2.0.10 → 2.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.
- checksums.yaml +7 -0
- metadata +18 -174
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -46
- data/Rakefile +0 -40
- data/app/views/rails_pagination/_pager.html.erb +0 -29
- data/config/locales/en.yml +0 -6
- data/config/locales/es.yml +0 -6
- data/lib/rails_pagination.rb +0 -11
- data/lib/rails_pagination/action_view/base.rb +0 -15
- data/lib/rails_pagination/active_record/base.rb +0 -28
- data/lib/rails_pagination/active_record/relation.rb +0 -81
- data/lib/rails_pagination/engine.rb +0 -7
- data/lib/rails_pagination/navigation.rb +0 -39
- data/lib/rails_pagination/pagination.rb +0 -97
- data/lib/rails_pagination/railtie.rb +0 -15
- data/lib/rails_pagination/version.rb +0 -5
- data/test/collection_empty_test.rb +0 -37
- data/test/collection_first_test.rb +0 -38
- data/test/collection_last_test.rb +0 -38
- data/test/collection_middle_test.rb +0 -38
- data/test/collection_padding_test.rb +0 -83
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/controllers/test_controller.rb +0 -7
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/model.rb +0 -3
- data/test/dummy/app/views/layouts/application.html.erb +0 -12
- data/test/dummy/app/views/test/index.html.erb +0 -1
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -59
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -37
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -61
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120908215532_create_models.rb +0 -8
- data/test/dummy/db/schema.rb +0 -22
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -3129
- data/test/dummy/log/test.log +0 -201719
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/tmp/cache/assets/CBF/7A0/sprockets%2Fc9192594b6d1b927590d37ebad844808 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D50/930/sprockets%2F277654ad498bbc928b88364ffcbad129 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D9B/E00/sprockets%2Fb66a75bd10bef6da5f16f4fa9113926c +0 -0
- data/test/dummy/tmp/cache/assets/DAC/650/sprockets%2Ff8ec2e25f819797cb9a491d0af22ae9b +0 -0
- data/test/dummy/tmp/cache/assets/DB2/700/sprockets%2Fa4f4b12a5cbea015faede527e4a04307 +0 -0
- data/test/dummy/tmp/cache/assets/DD5/C50/sprockets%2Fcdcdad84697d0b186a1de99f1950e5ab +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4 +0 -0
- data/test/helpers_empty_test.rb +0 -42
- data/test/helpers_first_test.rb +0 -43
- data/test/helpers_last_test.rb +0 -43
- data/test/helpers_middle_test.rb +0 -43
- data/test/test_helper.rb +0 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9f2aa5937f6bc095b8d14cbb9619fc47130b2cdb
|
4
|
+
data.tar.gz: 0307d192d471db4172cc8e65b0b6fbffd493fa15
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5eb2bcf47d43dfbb8daa749376593cba841ca3d9d83195d3ad00077127e87f34d2489c83b0922d7cdde9336ed28d2cf1f85ed252fccab03f768714211b4ce953
|
7
|
+
data.tar.gz: 2ed6912ee4230a21c5f0c41e63dd653a5bf679abebbbd7e9393113c659e8531380523fcb779c142d01d349b69d74852d3916c7d622ae8b7992738f6b1e00883f
|
metadata
CHANGED
@@ -1,214 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_pagination
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
5
|
-
prerelease:
|
4
|
+
version: 2.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mattways
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-08-20 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: pageable
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.8
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.8
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: sqlite3
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
17
|
+
- - '>='
|
36
18
|
- !ruby/object:Gem::Version
|
37
19
|
version: '0'
|
38
|
-
type: :
|
20
|
+
type: :runtime
|
39
21
|
prerelease: false
|
40
22
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
23
|
requirements:
|
43
|
-
- -
|
24
|
+
- - '>='
|
44
25
|
- !ruby/object:Gem::Version
|
45
26
|
version: '0'
|
46
|
-
description:
|
27
|
+
description: This gem has been renamed to just "pageable".
|
47
28
|
email:
|
48
29
|
- contact@mattways.com
|
49
30
|
executables: []
|
50
31
|
extensions: []
|
51
32
|
extra_rdoc_files: []
|
52
|
-
files:
|
53
|
-
|
54
|
-
|
55
|
-
-
|
56
|
-
|
57
|
-
- lib/rails_pagination/active_record/base.rb
|
58
|
-
- lib/rails_pagination/active_record/relation.rb
|
59
|
-
- lib/rails_pagination/engine.rb
|
60
|
-
- lib/rails_pagination/navigation.rb
|
61
|
-
- lib/rails_pagination/pagination.rb
|
62
|
-
- lib/rails_pagination/railtie.rb
|
63
|
-
- lib/rails_pagination/version.rb
|
64
|
-
- lib/rails_pagination.rb
|
65
|
-
- MIT-LICENSE
|
66
|
-
- Rakefile
|
67
|
-
- README.rdoc
|
68
|
-
- test/collection_empty_test.rb
|
69
|
-
- test/collection_first_test.rb
|
70
|
-
- test/collection_last_test.rb
|
71
|
-
- test/collection_middle_test.rb
|
72
|
-
- test/collection_padding_test.rb
|
73
|
-
- test/dummy/app/assets/javascripts/application.js
|
74
|
-
- test/dummy/app/assets/stylesheets/application.css
|
75
|
-
- test/dummy/app/controllers/application_controller.rb
|
76
|
-
- test/dummy/app/controllers/test_controller.rb
|
77
|
-
- test/dummy/app/helpers/application_helper.rb
|
78
|
-
- test/dummy/app/models/model.rb
|
79
|
-
- test/dummy/app/views/layouts/application.html.erb
|
80
|
-
- test/dummy/app/views/test/index.html.erb
|
81
|
-
- test/dummy/config/application.rb
|
82
|
-
- test/dummy/config/boot.rb
|
83
|
-
- test/dummy/config/database.yml
|
84
|
-
- test/dummy/config/environment.rb
|
85
|
-
- test/dummy/config/environments/development.rb
|
86
|
-
- test/dummy/config/environments/production.rb
|
87
|
-
- test/dummy/config/environments/test.rb
|
88
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
89
|
-
- test/dummy/config/initializers/inflections.rb
|
90
|
-
- test/dummy/config/initializers/mime_types.rb
|
91
|
-
- test/dummy/config/initializers/secret_token.rb
|
92
|
-
- test/dummy/config/initializers/session_store.rb
|
93
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
94
|
-
- test/dummy/config/locales/en.yml
|
95
|
-
- test/dummy/config/routes.rb
|
96
|
-
- test/dummy/config.ru
|
97
|
-
- test/dummy/db/development.sqlite3
|
98
|
-
- test/dummy/db/migrate/20120908215532_create_models.rb
|
99
|
-
- test/dummy/db/schema.rb
|
100
|
-
- test/dummy/db/test.sqlite3
|
101
|
-
- test/dummy/log/development.log
|
102
|
-
- test/dummy/log/test.log
|
103
|
-
- test/dummy/public/404.html
|
104
|
-
- test/dummy/public/422.html
|
105
|
-
- test/dummy/public/500.html
|
106
|
-
- test/dummy/public/favicon.ico
|
107
|
-
- test/dummy/Rakefile
|
108
|
-
- test/dummy/README.rdoc
|
109
|
-
- test/dummy/script/rails
|
110
|
-
- test/dummy/tmp/cache/assets/CBF/7A0/sprockets%2Fc9192594b6d1b927590d37ebad844808
|
111
|
-
- test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
112
|
-
- test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
113
|
-
- test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
|
114
|
-
- test/dummy/tmp/cache/assets/D50/930/sprockets%2F277654ad498bbc928b88364ffcbad129
|
115
|
-
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
116
|
-
- test/dummy/tmp/cache/assets/D9B/E00/sprockets%2Fb66a75bd10bef6da5f16f4fa9113926c
|
117
|
-
- test/dummy/tmp/cache/assets/DAC/650/sprockets%2Ff8ec2e25f819797cb9a491d0af22ae9b
|
118
|
-
- test/dummy/tmp/cache/assets/DB2/700/sprockets%2Fa4f4b12a5cbea015faede527e4a04307
|
119
|
-
- test/dummy/tmp/cache/assets/DD5/C50/sprockets%2Fcdcdad84697d0b186a1de99f1950e5ab
|
120
|
-
- test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
|
121
|
-
- test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7
|
122
|
-
- test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
|
123
|
-
- test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4
|
124
|
-
- test/helpers_empty_test.rb
|
125
|
-
- test/helpers_first_test.rb
|
126
|
-
- test/helpers_last_test.rb
|
127
|
-
- test/helpers_middle_test.rb
|
128
|
-
- test/test_helper.rb
|
129
|
-
homepage: https://github.com/mattways/rails_pagination
|
130
|
-
licenses: []
|
33
|
+
files: []
|
34
|
+
homepage: https://github.com/mattways/pageable
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata: {}
|
131
38
|
post_install_message:
|
132
39
|
rdoc_options: []
|
133
40
|
require_paths:
|
134
41
|
- lib
|
135
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
-
none: false
|
137
43
|
requirements:
|
138
|
-
- -
|
44
|
+
- - '>='
|
139
45
|
- !ruby/object:Gem::Version
|
140
46
|
version: '0'
|
141
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
-
none: false
|
143
48
|
requirements:
|
144
|
-
- -
|
49
|
+
- - '>='
|
145
50
|
- !ruby/object:Gem::Version
|
146
51
|
version: '0'
|
147
52
|
requirements: []
|
148
53
|
rubyforge_project:
|
149
|
-
rubygems_version:
|
54
|
+
rubygems_version: 2.0.3
|
150
55
|
signing_key:
|
151
|
-
specification_version:
|
152
|
-
summary:
|
153
|
-
test_files:
|
154
|
-
- test/collection_empty_test.rb
|
155
|
-
- test/collection_first_test.rb
|
156
|
-
- test/collection_last_test.rb
|
157
|
-
- test/collection_middle_test.rb
|
158
|
-
- test/collection_padding_test.rb
|
159
|
-
- test/dummy/app/assets/javascripts/application.js
|
160
|
-
- test/dummy/app/assets/stylesheets/application.css
|
161
|
-
- test/dummy/app/controllers/application_controller.rb
|
162
|
-
- test/dummy/app/controllers/test_controller.rb
|
163
|
-
- test/dummy/app/helpers/application_helper.rb
|
164
|
-
- test/dummy/app/models/model.rb
|
165
|
-
- test/dummy/app/views/layouts/application.html.erb
|
166
|
-
- test/dummy/app/views/test/index.html.erb
|
167
|
-
- test/dummy/config/application.rb
|
168
|
-
- test/dummy/config/boot.rb
|
169
|
-
- test/dummy/config/database.yml
|
170
|
-
- test/dummy/config/environment.rb
|
171
|
-
- test/dummy/config/environments/development.rb
|
172
|
-
- test/dummy/config/environments/production.rb
|
173
|
-
- test/dummy/config/environments/test.rb
|
174
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
175
|
-
- test/dummy/config/initializers/inflections.rb
|
176
|
-
- test/dummy/config/initializers/mime_types.rb
|
177
|
-
- test/dummy/config/initializers/secret_token.rb
|
178
|
-
- test/dummy/config/initializers/session_store.rb
|
179
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
180
|
-
- test/dummy/config/locales/en.yml
|
181
|
-
- test/dummy/config/routes.rb
|
182
|
-
- test/dummy/config.ru
|
183
|
-
- test/dummy/db/development.sqlite3
|
184
|
-
- test/dummy/db/migrate/20120908215532_create_models.rb
|
185
|
-
- test/dummy/db/schema.rb
|
186
|
-
- test/dummy/db/test.sqlite3
|
187
|
-
- test/dummy/log/development.log
|
188
|
-
- test/dummy/log/test.log
|
189
|
-
- test/dummy/public/404.html
|
190
|
-
- test/dummy/public/422.html
|
191
|
-
- test/dummy/public/500.html
|
192
|
-
- test/dummy/public/favicon.ico
|
193
|
-
- test/dummy/Rakefile
|
194
|
-
- test/dummy/README.rdoc
|
195
|
-
- test/dummy/script/rails
|
196
|
-
- test/dummy/tmp/cache/assets/CBF/7A0/sprockets%2Fc9192594b6d1b927590d37ebad844808
|
197
|
-
- test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
198
|
-
- test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
199
|
-
- test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
|
200
|
-
- test/dummy/tmp/cache/assets/D50/930/sprockets%2F277654ad498bbc928b88364ffcbad129
|
201
|
-
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
202
|
-
- test/dummy/tmp/cache/assets/D9B/E00/sprockets%2Fb66a75bd10bef6da5f16f4fa9113926c
|
203
|
-
- test/dummy/tmp/cache/assets/DAC/650/sprockets%2Ff8ec2e25f819797cb9a491d0af22ae9b
|
204
|
-
- test/dummy/tmp/cache/assets/DB2/700/sprockets%2Fa4f4b12a5cbea015faede527e4a04307
|
205
|
-
- test/dummy/tmp/cache/assets/DD5/C50/sprockets%2Fcdcdad84697d0b186a1de99f1950e5ab
|
206
|
-
- test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
|
207
|
-
- test/dummy/tmp/cache/assets/DEF/100/sprockets%2F8b9d88bfa8f8eed7910469ef2ab8a8c7
|
208
|
-
- test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
|
209
|
-
- test/dummy/tmp/cache/assets/E29/AA0/sprockets%2F6eaab4ab4dbae1b8b5a6f9286aa966d4
|
210
|
-
- test/helpers_empty_test.rb
|
211
|
-
- test/helpers_first_test.rb
|
212
|
-
- test/helpers_last_test.rb
|
213
|
-
- test/helpers_middle_test.rb
|
214
|
-
- test/test_helper.rb
|
56
|
+
specification_version: 4
|
57
|
+
summary: Renamed to just "pageable"
|
58
|
+
test_files: []
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2012 Mattways
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
{<img src="https://codeclimate.com/github/mattways/rails_pagination.png" />}[https://codeclimate.com/github/mattways/rails_pagination] {<img src="https://secure.travis-ci.org/mattways/rails_pagination.png?branch=master" alt="Build Status" />}[https://travis-ci.org/mattways/rails_pagination] {<img src="https://gemnasium.com/mattways/rails_pagination.png" alt="Dependency Status" />}[https://gemnasium.com/mattways/rails_pagination]
|
2
|
-
|
3
|
-
= Rails Pagination
|
4
|
-
|
5
|
-
Inspired in kaminari and will_paginate but more minimalistic
|
6
|
-
|
7
|
-
= Install
|
8
|
-
|
9
|
-
Put this line in your Gemfile:
|
10
|
-
gem 'rails_pagination'
|
11
|
-
|
12
|
-
Then bundle:
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
= Usage
|
16
|
-
|
17
|
-
The same approach as kaminari:
|
18
|
-
Model.page(1).per(20)
|
19
|
-
|
20
|
-
You can use the default html with this helper:
|
21
|
-
pager @collection
|
22
|
-
|
23
|
-
Or you can make your own just paginating the collection:
|
24
|
-
paginate @collection # Loot at app/views/rails_pagination/_pager.html.erb
|
25
|
-
|
26
|
-
= Configuration
|
27
|
-
|
28
|
-
== Default param name
|
29
|
-
|
30
|
-
If you want to change the default parameter name or the default navigation length call pager/paginate this way:
|
31
|
-
pager @collection, navigation: 3, parameter: :p
|
32
|
-
Or to set it globally put this in your application.rb:
|
33
|
-
config.pagination.default_parameter = :p
|
34
|
-
config.pagination.default_navigation = 5
|
35
|
-
|
36
|
-
== Default per page
|
37
|
-
|
38
|
-
If you want to change the default per_page put this in your model:
|
39
|
-
default_per_page 5
|
40
|
-
Or to set it globally put this in your application.rb:
|
41
|
-
config.pagination.default_per_page = 5
|
42
|
-
|
43
|
-
== Padding
|
44
|
-
|
45
|
-
You can use positive and negative padding:
|
46
|
-
Model.page(1).per(10).pad(-4)
|
data/Rakefile
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
begin
|
3
|
-
require 'bundler/setup'
|
4
|
-
rescue LoadError
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
14
|
-
|
15
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
17
|
-
rdoc.title = 'RailsPagination'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
22
|
-
|
23
|
-
APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
|
24
|
-
load 'rails/tasks/engine.rake'
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
Bundler::GemHelper.install_tasks
|
29
|
-
|
30
|
-
require 'rake/testtask'
|
31
|
-
|
32
|
-
Rake::TestTask.new(:test) do |t|
|
33
|
-
t.libs << 'lib'
|
34
|
-
t.libs << 'test'
|
35
|
-
t.pattern = 'test/**/*_test.rb'
|
36
|
-
t.verbose = false
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
task :default => :test
|
@@ -1,29 +0,0 @@
|
|
1
|
-
<% if pagination.has_multiple_pages? %>
|
2
|
-
<div class="pager">
|
3
|
-
<% if pagination.has_first_page? %>
|
4
|
-
<%= link_to t('pager.first'), pagination.first_page_path, class: 'first' %>
|
5
|
-
<% end %>
|
6
|
-
<% if pagination.has_previous_page? %>
|
7
|
-
<%= link_to t('pager.previous'), pagination.previous_page_path, class: 'previous' %>
|
8
|
-
<% end %>
|
9
|
-
<% if pagination.navigation.has_less_pages? %>
|
10
|
-
<span class="ellipsis">...</span>
|
11
|
-
<% end %>
|
12
|
-
<% pagination.navigation.pages.each do |page| %>
|
13
|
-
<% if pagination.is_current_page? page %>
|
14
|
-
<span class="page current"><%= page %></span>
|
15
|
-
<% else %>
|
16
|
-
<%= link_to page, pagination.page_path(page), class: 'page' %>
|
17
|
-
<% end %>
|
18
|
-
<% end %>
|
19
|
-
<% if pagination.navigation.has_more_pages? %>
|
20
|
-
<span class="ellipsis">...</span>
|
21
|
-
<% end %>
|
22
|
-
<% if pagination.has_next_page? %>
|
23
|
-
<%= link_to t('pager.next'), pagination.next_page_path, class: 'next' %>
|
24
|
-
<% end %>
|
25
|
-
<% if pagination.has_last_page? %>
|
26
|
-
<%= link_to t('pager.last'), pagination.last_page_path, class: 'last' %>
|
27
|
-
<% end %>
|
28
|
-
</div>
|
29
|
-
<% end %>
|
data/config/locales/en.yml
DELETED
data/config/locales/es.yml
DELETED
data/lib/rails_pagination.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'rails_pagination/action_view/base'
|
2
|
-
require 'rails_pagination/active_record/base'
|
3
|
-
require 'rails_pagination/active_record/relation'
|
4
|
-
require 'rails_pagination/navigation'
|
5
|
-
require 'rails_pagination/pagination'
|
6
|
-
require 'rails_pagination/engine'
|
7
|
-
require 'rails_pagination/railtie'
|
8
|
-
require 'rails_pagination/version'
|
9
|
-
|
10
|
-
module RailsPagination
|
11
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module RailsPagination
|
2
|
-
module ActionView
|
3
|
-
module Base
|
4
|
-
|
5
|
-
def paginate(*args)
|
6
|
-
Pagination.new *args.unshift(request)
|
7
|
-
end
|
8
|
-
|
9
|
-
def pager(*args)
|
10
|
-
render partial: 'rails_pagination/pager', locals: { pagination: paginate(*args) }
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module RailsPagination
|
2
|
-
module ActiveRecord
|
3
|
-
module Base
|
4
|
-
|
5
|
-
def inherited(subclass)
|
6
|
-
subclass.class_eval do
|
7
|
-
if superclass == ::ActiveRecord::Base
|
8
|
-
scope :page, Proc.new { |number|
|
9
|
-
limit(default_per_page).offset(default_per_page * ([number.to_i, 1].max - 1))
|
10
|
-
} do
|
11
|
-
include RailsPagination::ActiveRecord::Relation
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
super
|
16
|
-
end
|
17
|
-
|
18
|
-
def default_per_page(value=nil)
|
19
|
-
unless value.nil?
|
20
|
-
value = [value.to_i, 1].max
|
21
|
-
@default_per_page = value
|
22
|
-
end
|
23
|
-
defined?(@default_per_page).nil? ? Rails.application.config.pagination.default_per_page : @default_per_page
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|