page_up 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.travis.yml +10 -0
- data/README.md +44 -5
- data/Rakefile +11 -0
- data/lib/page_up/version.rb +1 -1
- data/page_up.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +4 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7345295fb84db01754653b39976ffaee5765a95
|
4
|
+
data.tar.gz: f783bdec5654e1c50d0825d1dfe69e7460ef7e4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a07d4689de5c566761b81fd6b4131b7df3a9a4becf56403e7459f40176a84c35706beb5179e3c9688ba6bbacc78e8e2cdc6ce77def280f95896bbd7c452be02e
|
7
|
+
data.tar.gz: 473bf60755ba27ec468ce343e3f798725f89146a862139947fe347348f8661c5448d1749809d9a04c734202a61d541d2a8f9f0fc571ea3a1bb3793cfd55e4314
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,49 @@
|
|
1
1
|
# PageUp
|
2
2
|
|
3
|
-
|
3
|
+
PageUp is a simple pagination gem, the idea being to use composition and
|
4
|
+
decoration of objects (rather than mixing into ActiveRecord) to divy up a
|
5
|
+
collection for pagination. This allows use with data sources other than ActiveRecord.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
To create a paginated collection use the `PageUp[]` macro.
|
10
|
+
|
11
|
+
`page_up_pages = PageUp[ collection, page_number, number_per_page ]`
|
12
|
+
|
13
|
+
In addition to delegating all the original collection methods back to the
|
14
|
+
underling object, a page up collection allows:
|
15
|
+
|
16
|
+
Access to the total number of pages with `pages`
|
17
|
+
|
18
|
+
`page_up_pages.pages => 3`
|
19
|
+
|
20
|
+
Access to the supplied page number with `page` (defaults to 1)
|
21
|
+
|
22
|
+
`page_up_pages.page => 2`
|
23
|
+
|
24
|
+
Access to the supplied per page count with `per_page` (defaults to 25)
|
25
|
+
|
26
|
+
`page_up_pages.per_page => 25`
|
27
|
+
|
28
|
+
And provides a range indicating the current section of pages, this is intended
|
29
|
+
for integration with output views to indicate nearby page bookmarks and as
|
30
|
+
such returns the previous two and next two pages, but is bounded so that at the
|
31
|
+
start or end of a collection always returns 5... e.g:
|
32
|
+
|
33
|
+
```
|
34
|
+
# page 2
|
35
|
+
page_up_pages.current_slice => 1..5
|
36
|
+
|
37
|
+
# page 7
|
38
|
+
page_up_pages.current_slice => 5..9
|
39
|
+
|
40
|
+
# page n-2
|
41
|
+
page_up_pages.current_slice => n-5..n
|
42
|
+
```
|
43
|
+
|
44
|
+
## ToDo
|
45
|
+
|
46
|
+
Extract helpers for integration with Rails and ORM libraries.
|
4
47
|
|
5
48
|
## Installation
|
6
49
|
|
@@ -16,10 +59,6 @@ Or install it yourself as:
|
|
16
59
|
|
17
60
|
$ gem install page_up
|
18
61
|
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
62
|
## Contributing
|
24
63
|
|
25
64
|
1. Fork it
|
data/Rakefile
CHANGED
data/lib/page_up/version.rb
CHANGED
data/page_up.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'page_up/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "page_up"
|
8
8
|
spec.version = PageUp::VERSION
|
9
|
-
spec.required_ruby_version = ">= 1.9.
|
9
|
+
spec.required_ruby_version = ">= 1.9.2"
|
10
10
|
spec.authors = ["Jon Rowe"]
|
11
11
|
spec.email = ["hello@jonrowe.co.uk"]
|
12
12
|
spec.description = %q{Simple paginator}
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: page_up
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Rowe
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
2feWfO4gCNmvfFjULOAYHq9JHEjN5SLSXvj5HdSnDcCyIfJKn5Ya3JahWQaWIsXf
|
30
30
|
/NPE/mB57TOwj+d7XUa2NC4HUadF8R51IYEcIB0PpIEzJlKtfXFcOZxO
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2013-07-
|
32
|
+
date: 2013-07-05 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rake
|
@@ -81,6 +81,7 @@ extensions: []
|
|
81
81
|
extra_rdoc_files: []
|
82
82
|
files:
|
83
83
|
- .gitignore
|
84
|
+
- .travis.yml
|
84
85
|
- Gemfile
|
85
86
|
- LICENSE.txt
|
86
87
|
- README.md
|
@@ -102,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
103
|
requirements:
|
103
104
|
- - '>='
|
104
105
|
- !ruby/object:Gem::Version
|
105
|
-
version: 1.9.
|
106
|
+
version: 1.9.2
|
106
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
109
|
- - '>='
|
metadata.gz.sig
CHANGED
Binary file
|