genki-dm-pagination 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,4 +1,23 @@
1
1
  dm-pagination
2
2
  =============
3
3
 
4
- A plugin for the Merb framework that provides ...
4
+ A plugin for the Merb framework that provides pagination for DataMapper.
5
+
6
+ USAGE:
7
+
8
+ In your controller,
9
+
10
+ class Posts
11
+ def index
12
+ @posts = Post.paginate(:page => params[:page])
13
+ end
14
+
15
+ In your view,
16
+
17
+ <ul>
18
+ <% @posts.each do |post| %>
19
+ <li><%= h(post.body) %></li>
20
+ <% end %>
21
+ </ul>
22
+ <%= paginate @posts %>
23
+
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'merb-core'
5
5
  require 'merb-core/tasks/merb'
6
6
 
7
7
  GEM_NAME = "dm-pagination"
8
- GEM_VERSION = "0.0.3"
8
+ GEM_VERSION = "0.1.0"
9
9
  AUTHOR = "Genki Takiuchi"
10
10
  EMAIL = "genki@s21g.com"
11
11
  HOMEPAGE = "http://blog.s21g.com/genki"
@@ -25,7 +25,7 @@ module DmPagination
25
25
  url(:page => @pagination.page - 1),
26
26
  :class => :prev, :rel => "prev"
27
27
  else
28
- span.call(prev_label)
28
+ span.call(prev_label, :prev)
29
29
  end
30
30
  end
31
31
 
@@ -33,9 +33,9 @@ module DmPagination
33
33
  if @pagination.page < @pagination.num_pages
34
34
  @context.link_to next_label,
35
35
  url(:page => @pagination.page + 1),
36
- :class => :older, :rel => "next"
36
+ :class => :next, :rel => "next"
37
37
  else
38
- span.call(next_label)
38
+ span.call(next_label, :next)
39
39
  end
40
40
  end
41
41
 
@@ -72,7 +72,8 @@ describe "dm-pagination" do
72
72
  it "should have rendered with pagination at page 2" do
73
73
  response = request "/pagination_builder/simple", :params => {:page => 2}
74
74
  response.should be_successful
75
- response.should have_selector("a[rel=prev]")
75
+ response.should have_selector("a.prev[rel=prev]")
76
+ response.should have_selector("a.next[rel=next]")
76
77
  response.body.scan(/Prev|Next/).should == %w(Prev Next)
77
78
  end
78
79
 
@@ -80,6 +81,11 @@ describe "dm-pagination" do
80
81
  response = request "/pagination_builder/variant"
81
82
  response.should be_successful
82
83
  response.body.scan(/Prev|Next/).should == %w(Next Prev)
84
+ response.should have_selector("a.next[rel=next]")
85
+ response.should_not have_selector("a.prev[rel=prev]")
86
+ response.should have_selector("span.prev")
87
+ response.should have_selector("span.number")
88
+ response.should_not have_selector("span.prev.number")
83
89
  end
84
90
  end
85
91
  end
@@ -1 +1 @@
1
- <%= paginate @posts, :pages, :next, :prev %>
1
+ <%= paginate @posts, :pages, :next, :prev, :style => 'number' %>
data/spec/spec_helper.rb CHANGED
@@ -5,6 +5,7 @@ require 'merb-core'
5
5
  require 'merb-helpers'
6
6
  require 'merb-assets'
7
7
  require 'dm-core'
8
+ require 'dm-pagination'
8
9
  require 'dm-pagination/paginatable'
9
10
  require 'dm-pagination/pagination_builder'
10
11
  require 'dm-aggregates'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genki-dm-pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Takiuchi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-15 00:00:00 -08:00
12
+ date: 2009-01-17 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency