pagination 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/pagination/adapters/ohm.rb +6 -4
- data/pagination.gemspec +2 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -5,6 +5,7 @@ module Pagination
|
|
5
5
|
|
6
6
|
@dataset = dataset
|
7
7
|
@total = dataset.size
|
8
|
+
@sort_by = options[:sort_by]
|
8
9
|
@order = options[:order]
|
9
10
|
@start = (page - 1) * per_page
|
10
11
|
end
|
@@ -15,18 +16,19 @@ module Pagination
|
|
15
16
|
|
16
17
|
protected
|
17
18
|
def collection
|
18
|
-
if @
|
19
|
+
if @sort_by
|
20
|
+
@dataset.sort_by @sort_by, sort_options
|
21
|
+
elsif @dataset.respond_to?(:sort)
|
19
22
|
@dataset.sort sort_options
|
20
23
|
else
|
21
|
-
@dataset.all
|
24
|
+
@dataset.all @start, per_page
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
25
28
|
def sort_options
|
26
29
|
{ :start => @start,
|
27
30
|
:limit => @per_page,
|
28
|
-
:order =>
|
29
|
-
:by => @order
|
31
|
+
:order => @order
|
30
32
|
}
|
31
33
|
end
|
32
34
|
end
|
data/pagination.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pagination}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Cyril David"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-05-02}
|
13
13
|
s.default_executable = %q{pagination}
|
14
14
|
s.description = %q{Trying to make the pagination world a better place}
|
15
15
|
s.email = %q{cyx.ucron@gmail.com}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagination
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril David
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-05-02 00:00:00 +08:00
|
13
13
|
default_executable: pagination
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|