pagers 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/lib/pagers/active_record/base.rb +7 -4
- data/lib/pagers/active_record/relation.rb +1 -1
- data/lib/pagers/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +37 -0
- data/test/dummy/log/test.log +2246 -0
- data/test/padding_test.rb +6 -6
- metadata +2 -3
- data/app/views/pagers/main.html.erb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60cb3aa5e6534fa01d610ee97b51a57a608fa1ea
|
4
|
+
data.tar.gz: 387fbe739a703c9bbace61aa93e8954b6f5f618a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd1833f8e500783bdf98ea79b575204cbfda882de16f8eead6aba6c7b2f15d0164a761fc59cf720af0ac4a3f3742afbf59d9be4053911146f3d0b6f237bf76dd
|
7
|
+
data.tar.gz: a77c456c35e087e34acfab715cded647c3feedb824dab64496cab3a66687d727edffacee513a551fd47132794fb5c09f78b71403d96fd820b81aa49dff8cf3e9
|
data/README.rdoc
CHANGED
@@ -9,12 +9,15 @@ module Pagers
|
|
9
9
|
subclass.class_eval do
|
10
10
|
if superclass == ::ActiveRecord::Base
|
11
11
|
scope :page, ->(number, options={}) {
|
12
|
-
length = options[:length] || Rails.application.config.pagers
|
13
|
-
padding = options[:padding] || Rails.application.config.pagers
|
12
|
+
length = options[:length] || Rails.application.config.pagers[:length]
|
13
|
+
padding = options[:padding] || Rails.application.config.pagers[:padding]
|
14
14
|
current_page = [number.to_i, 1].max
|
15
|
-
offset_value = (length * (current_page - 1)) +
|
16
|
-
limit_value = length
|
15
|
+
offset_value = (length * (current_page - 1)) + padding
|
16
|
+
limit_value = length
|
17
17
|
values = Module.new do
|
18
|
+
define_method :padding do
|
19
|
+
padding
|
20
|
+
end
|
18
21
|
define_method :page_length do
|
19
22
|
length
|
20
23
|
end
|
data/lib/pagers/version.rb
CHANGED
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -1234,3 +1234,40 @@ Processing by PagesController#index as HTML
|
|
1234
1234
|
Rendered /Users/Matt/Documents/Museways/Herramientas/Rails/pagers/app/views/pagers/_main.html.erb (0.6ms)
|
1235
1235
|
Rendered pages/index.html.erb within layouts/application (2.1ms)
|
1236
1236
|
Completed 200 OK in 5ms (Views: 4.8ms | ActiveRecord: 0.1ms)
|
1237
|
+
[1m[36mModel Load (1.3ms)[0m [1mSELECT "models".* FROM "models" LIMIT 4 OFFSET 0[0m
|
1238
|
+
[1m[35mModel Load (0.3ms)[0m SELECT "models".* FROM "models" LIMIT 4 OFFSET 0
|
1239
|
+
[1m[36mModel Load (0.4ms)[0m [1mSELECT "models".* FROM "models" LIMIT 4 OFFSET 0[0m
|
1240
|
+
[1m[36mModel Load (1.1ms)[0m [1mSELECT "models".* FROM "models" LIMIT 4 OFFSET 0[0m
|
1241
|
+
[1m[36mModel Load (1.2ms)[0m [1mSELECT "models".* FROM "models" LIMIT 4 OFFSET 0[0m
|
1242
|
+
|
1243
|
+
***** Debugger requested, but was not available (ensure the debugger gem is listed in Gemfile/installed as gem): Start server with --debugger to enable *****
|
1244
|
+
|
1245
|
+
[1m[36mModel Load (1.3ms)[0m [1mSELECT "models".* FROM "models" LIMIT 4 OFFSET 0[0m
|
1246
|
+
[1m[36mModel Load (1.1ms)[0m [1mSELECT "models".* FROM "models" LIMIT 4 OFFSET 0[0m
|
1247
|
+
[1m[36mModel Load (1.3ms)[0m [1mSELECT "models".* FROM "models" LIMIT 4 OFFSET 0[0m
|
1248
|
+
[1m[36mModel Load (1.1ms)[0m [1mSELECT "models".* FROM "models" LIMIT 4 OFFSET 0[0m
|
1249
|
+
[1m[36mModel Load (1.9ms)[0m [1mSELECT "models".* FROM "models" LIMIT 20 OFFSET 0[0m
|
1250
|
+
|
1251
|
+
|
1252
|
+
Started GET "/" for 127.0.0.1 at 2014-05-27 11:28:45 -0300
|
1253
|
+
[1m[36mActiveRecord::SchemaMigration Load (2.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1254
|
+
Processing by PagesController#index as HTML
|
1255
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "models"
|
1256
|
+
Rendered /Users/Matt/Documents/Museways/Herramientas/Rails/pagers/app/views/pagers/_main.html.erb (6.3ms)
|
1257
|
+
Rendered pages/index.html.erb within layouts/application (11.5ms)
|
1258
|
+
Completed 200 OK in 37ms (Views: 35.3ms | ActiveRecord: 0.4ms)
|
1259
|
+
|
1260
|
+
|
1261
|
+
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2014-05-27 11:28:45 -0300
|
1262
|
+
|
1263
|
+
|
1264
|
+
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2014-05-27 11:28:45 -0300
|
1265
|
+
|
1266
|
+
|
1267
|
+
Started GET "/?p=2" for 127.0.0.1 at 2014-05-27 11:28:47 -0300
|
1268
|
+
Processing by PagesController#index as HTML
|
1269
|
+
Parameters: {"p"=>"2"}
|
1270
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "models"[0m
|
1271
|
+
Rendered /Users/Matt/Documents/Museways/Herramientas/Rails/pagers/app/views/pagers/_main.html.erb (1.3ms)
|
1272
|
+
Rendered pages/index.html.erb within layouts/application (3.1ms)
|
1273
|
+
Completed 200 OK in 6ms (Views: 5.8ms | ActiveRecord: 0.1ms)
|