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.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +6 -6
- data/Rakefile +6 -3
- data/lib/pagers/version.rb +1 -1
- metadata +13 -113
- data/config/locales/en.yml +0 -6
- data/config/locales/es.yml +0 -6
- data/test/dummy/Rakefile +0 -5
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/controllers/products_controller.rb +0 -8
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/product.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -12
- data/test/dummy/app/views/products/index.html.erb +0 -1
- data/test/dummy/bin/bundle +0 -4
- data/test/dummy/bin/rails +0 -5
- data/test/dummy/bin/rake +0 -5
- data/test/dummy/bin/setup +0 -30
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -25
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -10
- data/test/dummy/config/database.yml.travis +0 -3
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -41
- data/test/dummy/config/environments/production.rb +0 -79
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/assets.rb +0 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/pagers.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -3
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/db/migrate/20130820024335_create_products.rb +0 -8
- data/test/dummy/db/schema.rb +0 -24
- data/test/dummy/log/development.log +0 -46
- data/test/dummy/log/test.log +0 -22437
- data/test/dummy/public/404.html +0 -61
- data/test/dummy/public/422.html +0 -61
- data/test/dummy/public/500.html +0 -60
- data/test/dummy/public/favicon.ico +0 -0
- data/test/generator_test.rb +0 -18
- data/test/relation_test.rb +0 -85
- data/test/test_helper.rb +0 -14
- data/test/view_test.rb +0 -47
data/test/dummy/public/404.html
DELETED
@@ -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>
|
data/test/dummy/public/422.html
DELETED
@@ -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>
|
data/test/dummy/public/500.html
DELETED
@@ -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
|
data/test/generator_test.rb
DELETED
@@ -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
|
data/test/relation_test.rb
DELETED
@@ -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
|
data/test/test_helper.rb
DELETED
@@ -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 }
|
data/test/view_test.rb
DELETED
@@ -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
|