just_paginate 0.0.2 → 0.0.3
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.
- data/lib/just_paginate.rb +27 -7
- metadata +76 -48
data/lib/just_paginate.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
module JustPaginate
|
2
3
|
|
3
|
-
VERSION = "0.0.
|
4
|
+
VERSION = "0.0.3"
|
4
5
|
|
5
6
|
def self.page_value(page)
|
6
7
|
if page.nil?
|
@@ -34,27 +35,46 @@ module JustPaginate
|
|
34
35
|
|
35
36
|
def self.page_navigation(curr_page, total_page_count, &page_link_constructor)
|
36
37
|
links = page_links(curr_page.to_i, total_page_count, &page_link_constructor)
|
37
|
-
return "<
|
38
|
+
return "<div class='pagination'>#{links}</div>"
|
38
39
|
end
|
39
40
|
|
41
|
+
# Create gitorous-style-pagination until we move to Bootstrap
|
42
|
+
# <div class="pagination">
|
43
|
+
# <a href="/projects?page=24" class="prev_page" rel="prev">Previous</a>
|
44
|
+
# <a href="/projects?page=1" rel="start">1</a>
|
45
|
+
# <span class="gap">…</span>
|
46
|
+
# <a href="/projects?page=21">21</a>
|
47
|
+
# <a href="/projects?page=22">22</a>
|
48
|
+
# <a href="/projects?page=23">23</a>
|
49
|
+
# <a href="/projects?page=24" rel="prev">24</a> <span class="current">25</span>
|
50
|
+
# <a href="/projects?page=26" rel="next">26</a>
|
51
|
+
# <a href="/projects?page=27">27</a>
|
52
|
+
# <a href="/projects?page=28">28</a>
|
53
|
+
# <a href="/projects?page=29">29</a>
|
54
|
+
# <span class="gap">…</span>
|
55
|
+
# <a href="/projects?page=1446">1446</a>
|
56
|
+
# <a href="/projects?page=26" class="next_page" rel="next">Next</a>
|
57
|
+
# </div>
|
58
|
+
|
59
|
+
|
40
60
|
def self.page_links(curr_page, total_page_count, &page_link_constructor)
|
41
61
|
page_labels(curr_page, total_page_count).map do |label|
|
42
62
|
page_element = ""
|
43
63
|
|
44
64
|
if label == "..."
|
45
|
-
page_element = "<span class='
|
65
|
+
page_element = "<span class='gap'>#{label}</span>"
|
46
66
|
elsif label == "<"
|
47
67
|
page_url = yield(curr_page-1)
|
48
|
-
page_element = "<a class='
|
68
|
+
page_element = "<a class='prev_page' rel='prev' href='#{page_url}'>#{label}</a>"
|
49
69
|
elsif label == ">"
|
50
70
|
page_url = yield(curr_page+1)
|
51
|
-
page_element = "<a class='
|
71
|
+
page_element = "<a class='next_page' rel='next' href='#{page_url}'>#{label}</a>"
|
52
72
|
else
|
53
73
|
page_url = yield(label)
|
54
74
|
if label.to_i == curr_page
|
55
|
-
page_element = "<span class='
|
75
|
+
page_element = "<span class='current'>#{label}</span>"
|
56
76
|
else
|
57
|
-
page_element = "<a
|
77
|
+
page_element = "<a href='#{page_url}'>#{label}</a>"
|
58
78
|
end
|
59
79
|
end
|
60
80
|
|
metadata
CHANGED
@@ -1,57 +1,75 @@
|
|
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
|
+
hash: 25
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Gitorious AS
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-10-03 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
15
22
|
name: minitest
|
16
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
25
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
22
33
|
type: :development
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
26
36
|
name: shoulda
|
27
|
-
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
33
47
|
type: :development
|
34
|
-
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
37
50
|
name: shoulda-context
|
38
|
-
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
53
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
44
61
|
type: :development
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
linking to paginated things in your webpage
|
49
|
-
email:
|
62
|
+
version_requirements: *id003
|
63
|
+
description: Framework-agnostic support for paginating collections of things, and linking to paginated things in your webpage
|
64
|
+
email:
|
50
65
|
- support@gitorious.org
|
51
66
|
executables: []
|
67
|
+
|
52
68
|
extensions: []
|
69
|
+
|
53
70
|
extra_rdoc_files: []
|
54
|
-
|
71
|
+
|
72
|
+
files:
|
55
73
|
- .gitignore
|
56
74
|
- Gemfile
|
57
75
|
- README.md
|
@@ -60,29 +78,39 @@ files:
|
|
60
78
|
- lib/just_paginate.rb
|
61
79
|
- test/test_helper.rb
|
62
80
|
- test/test_just_paginate.rb
|
81
|
+
has_rdoc: true
|
63
82
|
homepage: https://gitorious.org/gitorious/just_paginate
|
64
83
|
licenses: []
|
84
|
+
|
65
85
|
post_install_message:
|
66
86
|
rdoc_options: []
|
67
|
-
|
87
|
+
|
88
|
+
require_paths:
|
68
89
|
- lib
|
69
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
91
|
none: false
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
hash: 3
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
version: "0"
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
100
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
hash: 3
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
version: "0"
|
81
108
|
requirements: []
|
109
|
+
|
82
110
|
rubyforge_project: just_paginate
|
83
|
-
rubygems_version: 1.
|
111
|
+
rubygems_version: 1.4.2
|
84
112
|
signing_key:
|
85
113
|
specification_version: 3
|
86
|
-
summary: Framework-agnostic support for paginating collections of things, and linking
|
87
|
-
to paginated things in your webpage
|
114
|
+
summary: Framework-agnostic support for paginating collections of things, and linking to paginated things in your webpage
|
88
115
|
test_files: []
|
116
|
+
|