genki-dm-pagination 0.1.2 → 0.1.2.1

Sign up to get free protection for your applications and to get access to all the features.
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.1.2"
8
+ GEM_VERSION = "0.1.2.1"
9
9
  AUTHOR = "Genki Takiuchi"
10
10
  EMAIL = "genki@s21g.com"
11
11
  HOMEPAGE = "http://blog.s21g.com/genki"
@@ -5,6 +5,7 @@ module DmPagination
5
5
  @pagination = pagination
6
6
  @block = block
7
7
  @options = args.last.kind_of?(Hash) ? args.pop : {}
8
+ @options[:page] ||= :page
8
9
  @args = args.blank? ? [:prev, :pages, :next] : args
9
10
  end
10
11
 
@@ -22,7 +23,7 @@ module DmPagination
22
23
  def link_to_prev
23
24
  if @pagination.page > 1
24
25
  @context.link_to prev_label,
25
- url(:page => @pagination.page - 1),
26
+ url(@options[:page] => @pagination.page - 1),
26
27
  :class => :prev, :rel => "prev"
27
28
  else
28
29
  span.call(prev_label, :prev)
@@ -32,7 +33,7 @@ module DmPagination
32
33
  def link_to_next
33
34
  if @pagination.page < @pagination.num_pages
34
35
  @context.link_to next_label,
35
- url(:page => @pagination.page + 1),
36
+ url(@options[:page] => @pagination.page + 1),
36
37
  :class => :next, :rel => "next"
37
38
  else
38
39
  span.call(next_label, :next)
@@ -61,7 +62,7 @@ module DmPagination
61
62
  if @block
62
63
  @block.call(page, *args)
63
64
  else
64
- @context.link_to(page, url(:page => page))
65
+ @context.link_to(page, url(@options[:page] => page))
65
66
  end
66
67
  end
67
68
 
@@ -79,6 +79,8 @@ describe "dm-pagination" do
79
79
  response.should have_selector("a.prev[rel=prev]")
80
80
  response.should have_selector("a.next[rel=next]")
81
81
  response.body.scan(/Prev|Next/).should == %w(Prev Next)
82
+ url = "/pagination_builder/simple?page=3"
83
+ response.should have_xpath("//a[@href='#{url}']")
82
84
  end
83
85
 
84
86
  it "should be able to control links" do
@@ -90,6 +92,8 @@ describe "dm-pagination" do
90
92
  response.should have_selector("span.prev")
91
93
  response.should have_selector("span.number")
92
94
  response.should_not have_selector("span.prev.number")
95
+ url = "/pagination_builder/variant?foo=2"
96
+ response.should have_xpath("//a[@href='#{url}']")
93
97
  end
94
98
  end
95
99
  end
@@ -1 +1 @@
1
- <%= paginate @posts, :pages, :next, :prev, :style => 'number' %>
1
+ <%= paginate @posts, :pages, :next, :prev, :style => 'number', :page => :foo %>
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.1.2
4
+ version: 0.1.2.1
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-23 00:00:00 -08:00
12
+ date: 2009-01-27 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency