pagers 3.0.0 → 3.0.1
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 +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
data/test/padding_test.rb
CHANGED
@@ -3,10 +3,10 @@ require 'test_helper'
|
|
3
3
|
class PaddingTest < ActiveSupport::TestCase
|
4
4
|
|
5
5
|
test "negative padding should have 1 page" do
|
6
|
-
|
6
|
+
19.times.each { |index| Model.create name: index }
|
7
7
|
|
8
8
|
relation = Model.page(1, length: 15, padding: 4)
|
9
|
-
assert_equal
|
9
|
+
assert_equal 15, relation.size
|
10
10
|
assert_equal 1, relation.total_pages
|
11
11
|
|
12
12
|
relation = Model.page(2, length: 15, padding: 4)
|
@@ -19,10 +19,10 @@ class PaddingTest < ActiveSupport::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
test "negative padding should have 2 pages" do
|
22
|
-
|
22
|
+
34.times.each { |index| Model.create name: index }
|
23
23
|
|
24
24
|
relation = Model.page(1, length: 15, padding: 4)
|
25
|
-
assert_equal
|
25
|
+
assert_equal 15, relation.size
|
26
26
|
assert_equal 2, relation.total_pages
|
27
27
|
|
28
28
|
relation = Model.page(2, length: 15, padding: 4)
|
@@ -35,10 +35,10 @@ class PaddingTest < ActiveSupport::TestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
test "negative padding should have 3 pages" do
|
38
|
-
|
38
|
+
49.times.each { |index| Model.create name: index }
|
39
39
|
|
40
40
|
relation = Model.page(1, length: 15, padding: 4)
|
41
|
-
assert_equal
|
41
|
+
assert_equal 15, relation.size
|
42
42
|
assert_equal 3, relation.total_pages
|
43
43
|
|
44
44
|
relation = Model.page(2, length: 15, padding: 4)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Museways
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -49,7 +49,6 @@ files:
|
|
49
49
|
- README.rdoc
|
50
50
|
- Rakefile
|
51
51
|
- app/views/pagers/_main.html.erb
|
52
|
-
- app/views/pagers/main.html.erb
|
53
52
|
- config/locales/en.yml
|
54
53
|
- config/locales/es.yml
|
55
54
|
- lib/pagers.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
<% if collection.total_pages > 1 %>
|
2
|
-
<ul class="pager">
|
3
|
-
<% if collection.previous_page %>
|
4
|
-
<li class="first">
|
5
|
-
<%= link_to t('pager.first'), page_path(collection.first_page, options) %>
|
6
|
-
</li>
|
7
|
-
<li class="previous">
|
8
|
-
<%= link_to t('pager.previous'), page_path(collection.previous_page, options) %>
|
9
|
-
</li>
|
10
|
-
<% end %>
|
11
|
-
<% if less_pages %>
|
12
|
-
<li class="ellipsis">
|
13
|
-
…
|
14
|
-
</li>
|
15
|
-
<% end %>
|
16
|
-
<% pages.each do |page| %>
|
17
|
-
<li class="page<%= ' current' if collection.current_page == page %>">
|
18
|
-
<%= link_to page, page_path(page, options) %>
|
19
|
-
</li>
|
20
|
-
<% end %>
|
21
|
-
<% if more_pages %>
|
22
|
-
<li class="ellipsis">
|
23
|
-
…
|
24
|
-
</li>
|
25
|
-
<% end %>
|
26
|
-
<% if collection.next_page %>
|
27
|
-
<li class="next">
|
28
|
-
<%= link_to t('pager.next'), page_path(collection.next_page, options) %>
|
29
|
-
</li>
|
30
|
-
<li class="last">
|
31
|
-
<%= link_to t('pager.last'), page_path(collection.last_page, options) %>
|
32
|
-
</li>
|
33
|
-
<% end %>
|
34
|
-
</ul>
|
35
|
-
<% end %>
|