pagers 4.0.0.1 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +6 -6
  4. data/Rakefile +6 -3
  5. data/lib/pagers/version.rb +1 -1
  6. metadata +13 -113
  7. data/config/locales/en.yml +0 -6
  8. data/config/locales/es.yml +0 -6
  9. data/test/dummy/Rakefile +0 -5
  10. data/test/dummy/app/assets/javascripts/application.js +0 -13
  11. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  12. data/test/dummy/app/controllers/application_controller.rb +0 -5
  13. data/test/dummy/app/controllers/products_controller.rb +0 -8
  14. data/test/dummy/app/helpers/application_helper.rb +0 -2
  15. data/test/dummy/app/models/product.rb +0 -2
  16. data/test/dummy/app/views/layouts/application.html.erb +0 -12
  17. data/test/dummy/app/views/products/index.html.erb +0 -1
  18. data/test/dummy/bin/bundle +0 -4
  19. data/test/dummy/bin/rails +0 -5
  20. data/test/dummy/bin/rake +0 -5
  21. data/test/dummy/bin/setup +0 -30
  22. data/test/dummy/config.ru +0 -4
  23. data/test/dummy/config/application.rb +0 -25
  24. data/test/dummy/config/boot.rb +0 -5
  25. data/test/dummy/config/database.yml +0 -10
  26. data/test/dummy/config/database.yml.travis +0 -3
  27. data/test/dummy/config/environment.rb +0 -5
  28. data/test/dummy/config/environments/development.rb +0 -41
  29. data/test/dummy/config/environments/production.rb +0 -79
  30. data/test/dummy/config/environments/test.rb +0 -42
  31. data/test/dummy/config/initializers/assets.rb +0 -11
  32. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  33. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  34. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  35. data/test/dummy/config/initializers/inflections.rb +0 -16
  36. data/test/dummy/config/initializers/mime_types.rb +0 -4
  37. data/test/dummy/config/initializers/pagers.rb +0 -7
  38. data/test/dummy/config/initializers/session_store.rb +0 -3
  39. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  40. data/test/dummy/config/locales/en.yml +0 -23
  41. data/test/dummy/config/routes.rb +0 -3
  42. data/test/dummy/config/secrets.yml +0 -22
  43. data/test/dummy/db/migrate/20130820024335_create_products.rb +0 -8
  44. data/test/dummy/db/schema.rb +0 -24
  45. data/test/dummy/log/development.log +0 -46
  46. data/test/dummy/log/test.log +0 -22437
  47. data/test/dummy/public/404.html +0 -61
  48. data/test/dummy/public/422.html +0 -61
  49. data/test/dummy/public/500.html +0 -60
  50. data/test/dummy/public/favicon.ico +0 -0
  51. data/test/generator_test.rb +0 -18
  52. data/test/relation_test.rb +0 -85
  53. data/test/test_helper.rb +0 -14
  54. data/test/view_test.rb +0 -47
@@ -1,61 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
- div.dialog {
15
- width: 95%;
16
- max-width: 33em;
17
- margin: 4em auto 0;
18
- }
19
- div.dialog > div {
20
- border: 1px solid #CCC;
21
- border-right-color: #999;
22
- border-left-color: #999;
23
- border-bottom-color: #BBB;
24
- border-top: #B00100 solid 4px;
25
- border-top-left-radius: 9px;
26
- border-top-right-radius: 9px;
27
- background-color: white;
28
- padding: 7px 12% 0;
29
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
- }
31
- h1 {
32
- font-size: 100%;
33
- color: #730E15;
34
- line-height: 1.5em;
35
- }
36
- div.dialog > p {
37
- margin: 0 0 1em;
38
- padding: 1em;
39
- background-color: #F7F7F7;
40
- border: 1px solid #CCC;
41
- border-right-color: #999;
42
- border-left-color: #999;
43
- border-bottom-color: #999;
44
- border-bottom-left-radius: 4px;
45
- border-bottom-right-radius: 4px;
46
- border-top-color: #DADADA;
47
- color: #666;
48
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
49
- }
50
- </style>
51
- </head>
52
- <body>
53
- <div class="dialog">
54
- <div>
55
- <h1>The page you were looking for doesn't exist.</h1>
56
- <p>You may have mistyped the address or the page may have moved.</p>
57
- </div>
58
- <p>If you are the application owner check the logs for more information.</p>
59
- </div>
60
- </body>
61
- </html>
@@ -1,61 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
- div.dialog {
15
- width: 95%;
16
- max-width: 33em;
17
- margin: 4em auto 0;
18
- }
19
- div.dialog > div {
20
- border: 1px solid #CCC;
21
- border-right-color: #999;
22
- border-left-color: #999;
23
- border-bottom-color: #BBB;
24
- border-top: #B00100 solid 4px;
25
- border-top-left-radius: 9px;
26
- border-top-right-radius: 9px;
27
- background-color: white;
28
- padding: 7px 12% 0;
29
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
- }
31
- h1 {
32
- font-size: 100%;
33
- color: #730E15;
34
- line-height: 1.5em;
35
- }
36
- div.dialog > p {
37
- margin: 0 0 1em;
38
- padding: 1em;
39
- background-color: #F7F7F7;
40
- border: 1px solid #CCC;
41
- border-right-color: #999;
42
- border-left-color: #999;
43
- border-bottom-color: #999;
44
- border-bottom-left-radius: 4px;
45
- border-bottom-right-radius: 4px;
46
- border-top-color: #DADADA;
47
- color: #666;
48
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
49
- }
50
- </style>
51
- </head>
52
- <body>
53
- <div class="dialog">
54
- <div>
55
- <h1>The change you wanted was rejected.</h1>
56
- <p>Maybe you tried to change something you didn't have access to.</p>
57
- </div>
58
- <p>If you are the application owner check the logs for more information.</p>
59
- </div>
60
- </body>
61
- </html>
@@ -1,60 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <style>
7
- body {
8
- background-color: #EFEFEF;
9
- color: #2E2F30;
10
- text-align: center;
11
- font-family: arial, sans-serif;
12
- margin: 0;
13
- }
14
- div.dialog {
15
- width: 95%;
16
- max-width: 33em;
17
- margin: 4em auto 0;
18
- }
19
- div.dialog > div {
20
- border: 1px solid #CCC;
21
- border-right-color: #999;
22
- border-left-color: #999;
23
- border-bottom-color: #BBB;
24
- border-top: #B00100 solid 4px;
25
- border-top-left-radius: 9px;
26
- border-top-right-radius: 9px;
27
- background-color: white;
28
- padding: 7px 12% 0;
29
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
30
- }
31
- h1 {
32
- font-size: 100%;
33
- color: #730E15;
34
- line-height: 1.5em;
35
- }
36
- div.dialog > p {
37
- margin: 0 0 1em;
38
- padding: 1em;
39
- background-color: #F7F7F7;
40
- border: 1px solid #CCC;
41
- border-right-color: #999;
42
- border-left-color: #999;
43
- border-bottom-color: #999;
44
- border-bottom-left-radius: 4px;
45
- border-bottom-right-radius: 4px;
46
- border-top-color: #DADADA;
47
- color: #666;
48
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
49
- }
50
- </style>
51
- </head>
52
- <body>
53
- <div class="dialog">
54
- <div>
55
- <h1>We're sorry, but something went wrong.</h1>
56
- </div>
57
- <p>If you are the application owner check the logs for more information.</p>
58
- </div>
59
- </body>
60
- </html>
File without changes
@@ -1,18 +0,0 @@
1
- require 'test_helper'
2
- require 'rails/generators'
3
- require 'generators/pagers/install/install_generator'
4
-
5
- class GeneratorsTest < Rails::Generators::TestCase
6
- destination Rails.root.join('tmp')
7
-
8
- teardown do
9
- FileUtils.rm_rf destination_root
10
- end
11
-
12
- test 'install' do
13
- self.class.tests Pagers::Generators::InstallGenerator
14
- run_generator
15
- assert_file 'config/initializers/pagers.rb'
16
- end
17
-
18
- end
@@ -1,85 +0,0 @@
1
- require 'test_helper'
2
-
3
- class RelationTest < ActiveSupport::TestCase
4
-
5
- test 'empty' do
6
- products = Product.page(1, length: 2)
7
-
8
- assert_equal 1, products.total_pages
9
- assert_equal 1, products.current_page
10
- assert_equal 1, products.first_page
11
- assert_nil products.previous_page
12
- assert_nil products.next_page
13
- assert_equal 1, products.last_page
14
- assert_not products.out_of_bounds?
15
- end
16
-
17
- test 'first' do
18
- 10.times { Product.create }
19
- products = Product.page(1, length: 2)
20
-
21
- assert_equal 5, products.total_pages
22
- assert_equal 1, products.current_page
23
- assert_equal 1, products.first_page
24
- assert_nil products.previous_page
25
- assert_equal 2, products.next_page
26
- assert_equal 5, products.last_page
27
- assert_not products.out_of_bounds?
28
- end
29
-
30
- test 'middle' do
31
- 10.times { Product.create }
32
- products = Product.page(3, length: 2)
33
-
34
- assert_equal 5, products.total_pages
35
- assert_equal 3, products.current_page
36
- assert_equal 1, products.first_page
37
- assert_equal 2, products.previous_page
38
- assert_equal 4, products.next_page
39
- assert_equal 5, products.last_page
40
- assert_not products.out_of_bounds?
41
- end
42
-
43
- test 'last' do
44
- 10.times { Product.create }
45
- products = Product.page(5, length: 2)
46
-
47
- assert_equal 5, products.total_pages
48
- assert_equal 5, products.current_page
49
- assert_equal 1, products.first_page
50
- assert_equal 4, products.previous_page
51
- assert_nil products.next_page
52
- assert_equal 5, products.last_page
53
- assert_not products.out_of_bounds?
54
- end
55
-
56
- test 'out' do
57
- 10.times { Product.create }
58
- products = Product.page(6, length: 2)
59
-
60
- assert_equal 5, products.total_pages
61
- assert_equal 6, products.current_page
62
- assert_equal 1, products.first_page
63
- assert_equal 5, products.previous_page
64
- assert_nil products.next_page
65
- assert_equal 5, products.last_page
66
- assert products.out_of_bounds?
67
- end
68
-
69
- test 'padding' do
70
- 19.times { Product.create }
71
-
72
- products = Product.page(1, length: 15, padding: 4)
73
- assert_equal 15, products.size
74
- assert_equal 1, products.total_pages
75
-
76
- products = Product.page(2, length: 15, padding: 4)
77
- assert_equal 0, products.size
78
- assert_equal 1, products.total_pages
79
-
80
- products = Product.page(3, length: 15, padding: 4)
81
- assert_equal 0, products.size
82
- assert_equal 1, products.total_pages
83
- end
84
-
85
- end
@@ -1,14 +0,0 @@
1
- # Configure Rails Environment
2
- ENV['RAILS_ENV'] = 'test'
3
-
4
- require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
5
- ActiveRecord::Migrator.migrations_paths = [File.expand_path('../../test/dummy/db/migrate', __FILE__)]
6
- ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
7
- require 'rails/test_help'
8
-
9
- # Filter out Minitest backtrace while allowing backtrace from other libraries
10
- # to be shown.
11
- Minitest.backtrace_filter = Minitest::BacktraceFilter.new
12
-
13
- # Load support files
14
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -1,47 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ViewTest < ActionDispatch::IntegrationTest
4
-
5
- setup do
6
- 10.times { Product.create }
7
- end
8
-
9
- test 'html' do
10
- get '/'
11
- assert_select 'li.first', false
12
- assert_select 'li.previous', false
13
- assert_select 'li.page.current a[href=?]', '/', text: /1/, count: 1
14
- assert_select 'li.page a[href=?]', '/?page=2', text: /2/, count: 1
15
- assert_select 'li.page a[href=?]', '/?page=3', text: /3/, count: 1
16
- assert_select 'li.page a[href=?]', '/?page=4', text: /4/, count: 1
17
- assert_select 'li.page a[href=?]', '/?page=5', text: /5/, count: 1
18
- assert_select 'li.next a[href=?]', '/?page=2', text: /Next/, count: 1
19
- assert_select 'li.last a[href=?]', '/?page=10', text: /Last/, count: 1
20
- assert_select 'li.ellipsis', text: /…/, count: 1
21
-
22
- get '/?page=5'
23
- assert_select 'li.first a[href=?]', '/', text: /First/, count: 1
24
- assert_select 'li.previous a[href=?]', '/?page=4', text: /Previous/, count: 1
25
- assert_select 'li.page a[href=?]', '/?page=3', text: /3/, count: 1
26
- assert_select 'li.page a[href=?]', '/?page=4', text: /4/, count: 1
27
- assert_select 'li.page.current a[href=?]', '/?page=5', text: /5/, count: 1
28
- assert_select 'li.page a[href=?]', '/?page=6', text: /6/, count: 1
29
- assert_select 'li.page a[href=?]', '/?page=7', text: /7/, count: 1
30
- assert_select 'li.next a[href=?]', '/?page=6', text: /Next/, count: 1
31
- assert_select 'li.last a[href=?]', '/?page=10', text: /Last/, count: 1
32
- assert_select 'li.ellipsis', text: /…/, count: 2
33
-
34
- get '/?page=10'
35
- assert_select 'li.first a[href=?]', '/', text: /First/, count: 1
36
- assert_select 'li.previous a[href=?]', '/?page=9', text: /Previous/, count: 1
37
- assert_select 'li.page a[href=?]', '/?page=6', text: /6/, count: 1
38
- assert_select 'li.page a[href=?]', '/?page=7', text: /7/, count: 1
39
- assert_select 'li.page a[href=?]', '/?page=8', text: /8/, count: 1
40
- assert_select 'li.page a[href=?]', '/?page=9', text: /9/, count: 1
41
- assert_select 'li.page.current a[href=?]', '/?page=10', text: /10/, count: 1
42
- assert_select 'li.next', false
43
- assert_select 'li.last', false
44
- assert_select 'li.ellipsis', text: /…/, count: 1
45
- end
46
-
47
- end