paginate 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -63,6 +63,16 @@ If you want to translate links, you have implement the following scopes:
63
63
  previous: "Newer"
64
64
  page: "Page {{page}}"
65
65
 
66
+ == Styling
67
+
68
+ If you want something like Twitter Search use this CSS:
69
+
70
+ .paginate { overflow: hidden; }
71
+ .paginate li { float: left; }
72
+ .paginate li.previous-page:after { content: "«"; padding: 0 5px; }
73
+ .paginate li.next-page:before { content: "»"; padding: 0 5px; }
74
+ .paginate .disabled { display: none; }
75
+
66
76
  == License
67
77
 
68
78
  (The MIT License)
@@ -46,19 +46,19 @@ module Paginate
46
46
 
47
47
  # Previous page
48
48
  if processor.previous_page?
49
- html << %[<li><a class="previous-page" href="#{previous_url}" title="#{previous_label}">#{previous_label}</a></li>]
49
+ html << %[<li class="previous-page"><a href="#{previous_url}" title="#{previous_label}">#{previous_label}</a></li>]
50
50
  else
51
- html << %[<li><span class="previous-page disabled" title="#{previous_label}">#{previous_label}</span></li>]
51
+ html << %[<li class="previous-page disabled"><span title="#{previous_label}">#{previous_label}</span></li>]
52
52
  end
53
53
 
54
54
  # Current page
55
- html << %[<li><span class="page">#{page_label}</span></li>]
55
+ html << %[<li class="page"><span>#{page_label}</span></li>]
56
56
 
57
57
  # Next page
58
58
  if processor.next_page?
59
- html << %[<li><a class="next-page" href="#{next_url}" title="#{next_label}">#{next_label}</a></li>]
59
+ html << %[<li class="next-page"><a href="#{next_url}" title="#{next_label}">#{next_label}</a></li>]
60
60
  else
61
- html << %[<li><span class="next-page disabled" title="#{next_label}">#{next_label}</span></li>]
61
+ html << %[<li class="next-page disabled"><span title="#{next_label}">#{next_label}</span></li>]
62
62
  end
63
63
 
64
64
  html << %[</ul>]
@@ -2,7 +2,7 @@ module Paginate
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -42,7 +42,7 @@ class ActionViewTest < Test::Unit::TestCase
42
42
  def test_display_next_page_link
43
43
  @request.fullpath = "/some/path?page=1"
44
44
  html = render(:default, Array.new(11))
45
- link = html.css("li > a.next-page").first
45
+ link = html.css("li.next-page > a").first
46
46
 
47
47
  assert_not_nil link
48
48
  assert_equal "/some/path?page=2", link["href"]
@@ -52,7 +52,7 @@ class ActionViewTest < Test::Unit::TestCase
52
52
  def test_display_next_page_link_from_block
53
53
  @request.fullpath = "/some/path?page=1"
54
54
  html = render(:block_as_url, Array.new(11))
55
- link = html.css("li > a.next-page").first
55
+ link = html.css("li.next-page > a").first
56
56
 
57
57
  assert_not_nil link
58
58
  assert_equal "/some/path/2", link["href"]
@@ -63,7 +63,7 @@ class ActionViewTest < Test::Unit::TestCase
63
63
  @params[:page] = 2
64
64
  @request.fullpath = "/some/path?page=2"
65
65
  html = render(:default, Array.new(11))
66
- link = html.css("li > a.previous-page").first
66
+ link = html.css("li.previous-page > a").first
67
67
 
68
68
  assert_not_nil link
69
69
  assert_equal "/some/path?page=1", link["href"]
@@ -73,8 +73,8 @@ class ActionViewTest < Test::Unit::TestCase
73
73
  def test_display_next_page_as_disabled
74
74
  @request.fullpath = "/some/path?page=1"
75
75
  html = render(:default, Array.new(10))
76
- link = html.css("li > a.next-page").first
77
- span = html.css("li > span.next-page.disabled").first
76
+ link = html.css("li.next-page > a").first
77
+ span = html.css("li.next-page.disabled > span").first
78
78
 
79
79
  assert_nil link
80
80
  assert_not_nil span
@@ -84,8 +84,8 @@ class ActionViewTest < Test::Unit::TestCase
84
84
  def test_display_previous_page_as_disabled
85
85
  @request.fullpath = "/some/path?page=1"
86
86
  html = render(:default, Array.new(10))
87
- link = html.css("li > a.previous-page").first
88
- span = html.css("li > span.previous-page.disabled").first
87
+ link = html.css("li.previous-page > a").first
88
+ span = html.css("li.previous-page.disabled > span").first
89
89
 
90
90
  assert_nil link
91
91
  assert_not_nil span
@@ -96,7 +96,7 @@ class ActionViewTest < Test::Unit::TestCase
96
96
  @params[:page] = 10
97
97
  @request.fullpath = "/some/path?page=10"
98
98
  html = render(:default, [])
99
- span = html.css("li > span.page").first
99
+ span = html.css("li.page > span").first
100
100
 
101
101
  assert_not_nil span
102
102
  assert_equal "Page 10", span.text
@@ -109,9 +109,9 @@ class ActionViewTest < Test::Unit::TestCase
109
109
  @request.fullpath = "/some/path?page=10"
110
110
  html = render(:default, Array.new(11))
111
111
 
112
- assert_equal "Página 10", html.css("span.page").text
113
- assert_equal "Próxima página", html.css("a.next-page").text
114
- assert_equal "Página anterior", html.css("a.previous-page").text
112
+ assert_equal "Página 10", html.css("li.page > span").text
113
+ assert_equal "Próxima página", html.css("li.next-page > a").text
114
+ assert_equal "Página anterior", html.css("li.previous-page > a").text
115
115
  end
116
116
 
117
117
  def test_iterate
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nando Vieira