just_paginate 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/just_paginate.rb +2 -2
- data/test/test_just_paginate.rb +4 -3
- metadata +48 -76
data/lib/just_paginate.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
module JustPaginate
|
3
3
|
|
4
|
-
VERSION = "0.0.
|
4
|
+
VERSION = "0.0.6"
|
5
5
|
|
6
6
|
def self.page_value(page)
|
7
7
|
if page.nil?
|
@@ -19,7 +19,7 @@ module JustPaginate
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.total_page_number(total_entry_count, per_page)
|
22
|
-
total_entry_count / per_page
|
22
|
+
(total_entry_count.to_f / per_page).ceil
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.index_range(curr_page, per_page, total_entry_count)
|
data/test/test_just_paginate.rb
CHANGED
@@ -29,10 +29,8 @@ class JustPaginateTest < Test::Unit::TestCase
|
|
29
29
|
|
30
30
|
should "calculate correct total page count" do
|
31
31
|
assert_equal 25, JustPaginate.total_page_number(500, 20)
|
32
|
-
|
33
|
-
|
32
|
+
assert_equal 25, JustPaginate.total_page_number(498, 20)
|
34
33
|
end
|
35
|
-
|
36
34
|
|
37
35
|
should "correctly apply the supplied selection strategy" do
|
38
36
|
ran = false
|
@@ -89,6 +87,9 @@ class JustPaginateTest < Test::Unit::TestCase
|
|
89
87
|
assert_correct_paging_labels "< 1 ... 41 42 43 44 45 46 47 48 49 50", 41, 50
|
90
88
|
assert_correct_paging_labels "< 1 ... 41 42 43 44 45 46 47 48 49 50", 45, 50
|
91
89
|
assert_correct_paging_labels "< 1 ... 41 42 43 44 45 46 47 48 49 50", 50, 50
|
90
|
+
|
91
|
+
assert_correct_paging_labels "< 1 ... 16 17 18 19 20 21 22 23 24 25", 24, 25
|
92
|
+
assert_correct_paging_labels "< 1 ... 16 17 18 19 20 21 22 23 24 25", 25, 25
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
metadata
CHANGED
@@ -1,75 +1,57 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: just_paginate
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 0.0.5
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Gitorious AS
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-10-03 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: minitest
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &14780680 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: shoulda
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *14780680
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: shoulda
|
27
|
+
requirement: &14780100 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
47
33
|
type: :development
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: shoulda-context
|
51
34
|
prerelease: false
|
52
|
-
|
35
|
+
version_requirements: *14780100
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: shoulda-context
|
38
|
+
requirement: &14779560 !ruby/object:Gem::Requirement
|
53
39
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
61
44
|
type: :development
|
62
|
-
|
63
|
-
|
64
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *14779560
|
47
|
+
description: Framework-agnostic support for paginating collections of things, and
|
48
|
+
linking to paginated things in your webpage
|
49
|
+
email:
|
65
50
|
- support@gitorious.org
|
66
51
|
executables: []
|
67
|
-
|
68
52
|
extensions: []
|
69
|
-
|
70
53
|
extra_rdoc_files: []
|
71
|
-
|
72
|
-
files:
|
54
|
+
files:
|
73
55
|
- .gitignore
|
74
56
|
- Gemfile
|
75
57
|
- README.md
|
@@ -78,39 +60,29 @@ files:
|
|
78
60
|
- lib/just_paginate.rb
|
79
61
|
- test/test_helper.rb
|
80
62
|
- test/test_just_paginate.rb
|
81
|
-
has_rdoc: true
|
82
63
|
homepage: https://gitorious.org/gitorious/just_paginate
|
83
64
|
licenses: []
|
84
|
-
|
85
65
|
post_install_message:
|
86
66
|
rdoc_options: []
|
87
|
-
|
88
|
-
require_paths:
|
67
|
+
require_paths:
|
89
68
|
- lib
|
90
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
70
|
none: false
|
92
|
-
requirements:
|
93
|
-
- -
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
|
96
|
-
|
97
|
-
- 0
|
98
|
-
version: "0"
|
99
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
76
|
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
|
105
|
-
segments:
|
106
|
-
- 0
|
107
|
-
version: "0"
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
108
81
|
requirements: []
|
109
|
-
|
110
82
|
rubyforge_project: just_paginate
|
111
|
-
rubygems_version: 1.
|
83
|
+
rubygems_version: 1.8.15
|
112
84
|
signing_key:
|
113
85
|
specification_version: 3
|
114
|
-
summary: Framework-agnostic support for paginating collections of things, and linking
|
86
|
+
summary: Framework-agnostic support for paginating collections of things, and linking
|
87
|
+
to paginated things in your webpage
|
115
88
|
test_files: []
|
116
|
-
|