will_paginate_renderers 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- will_paginate_renderers (0.0.1)
5
- will_paginate (= 3.0.pre2)
4
+ will_paginate_renderers (0.0.2)
5
+ will_paginate (= 3.0.pre4)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
@@ -11,17 +11,15 @@ GEM
11
11
  mocha (0.9.8)
12
12
  rake
13
13
  rake (0.8.7)
14
- rspec (2.0.1)
15
- rspec-core (~> 2.0.1)
16
- rspec-expectations (~> 2.0.1)
17
- rspec-mocks (~> 2.0.1)
18
- rspec-core (2.0.1)
19
- rspec-expectations (2.0.1)
20
- diff-lcs (>= 1.1.2)
21
- rspec-mocks (2.0.1)
22
- rspec-core (~> 2.0.1)
23
- rspec-expectations (~> 2.0.1)
24
- will_paginate (3.0.pre2)
14
+ rspec (2.6.0)
15
+ rspec-core (~> 2.6.0)
16
+ rspec-expectations (~> 2.6.0)
17
+ rspec-mocks (~> 2.6.0)
18
+ rspec-core (2.6.4)
19
+ rspec-expectations (2.6.0)
20
+ diff-lcs (~> 1.1.2)
21
+ rspec-mocks (2.6.0)
22
+ will_paginate (3.0.pre4)
25
23
  yard (0.6.1)
26
24
 
27
25
  PLATFORMS
@@ -29,7 +27,6 @@ PLATFORMS
29
27
 
30
28
  DEPENDENCIES
31
29
  mocha (~> 0.9)
32
- rspec (~> 2.0.0)
33
- will_paginate (= 3.0.pre2)
30
+ rspec (~> 2.6)
34
31
  will_paginate_renderers!
35
32
  yard
data/README.md CHANGED
@@ -1,33 +1,73 @@
1
- # Will Paginate Renderers
1
+ # Will Paginate Renderers ![](http://stillmaintained.com/tsigo/will_paginate_renderers.png)
2
2
 
3
3
  A collection of custom renderers for use with the
4
- [will_paginate](http://github.com/mislav/will_paginate) view helper.
4
+ [will_paginate](http://github.com/mislav/will_paginate) gem.
5
+
6
+ ## Requirements
7
+
8
+ will_paginate_renderers currently depends explicitly on [will_paginate
9
+ 3.0.pre4](https://rubygems.org/gems/will_paginate/versions/3.0.pre4), but will
10
+ in the future support any 3.0.x version once a stable version is released.
11
+
12
+ The easiest way to make use of will_paginate_renderers is through
13
+ [Bundler](http://gembundler.com/) by adding the following to your Gemfile:
14
+
15
+ gem 'will_paginate'
16
+ gem 'will_paginate_renderers'
17
+
18
+ Note that although `will_paginate_renderers` lists `will_paginate` as a
19
+ dependency, you still need it in your Gemfile in order to make sure it's
20
+ required properly.
21
+
22
+ Once installed, just tell the `will_paginate` helper which renderer to use (see
23
+ below).
5
24
 
6
25
  ## Renderers Provided
7
26
 
8
27
  ### Gmail
9
28
 
29
+ **Preview**:
30
+
10
31
  ![](http://img.skitch.com/20101022-kf5u89brk4q66rfiyc2xs4wyug.jpg)
11
32
 
33
+ **Usage**:
34
+
35
+ will_paginate(@posts, :renderer => WillPaginateRenderers::Gmail)
36
+
37
+ #### Customization
38
+
39
+ You can change the label and CSS class of the "Newest", "Newer", "Older" and
40
+ "Oldest" links, and you can change the CSS class of the "window" span, which is
41
+ the text that shows the current, end and total counts.
42
+
43
+ WillPaginateRenderers.pagination_options[:gmail_newest_label] = "Newest"
44
+ WillPaginateRenderers.pagination_options[:gmail_newer_label] = "Newer"
45
+ WillPaginateRenderers.pagination_options[:gmail_older_label] = "Older"
46
+ WillPaginateRenderers.pagination_options[:gmail_oldest_label] = "Oldest"
47
+
48
+ WillPaginateRenderers.pagination_options[:gmail_newest_class] = 'newest'
49
+ WillPaginateRenderers.pagination_options[:gmail_newer_class] = 'newer'
50
+ WillPaginateRenderers.pagination_options[:gmail_older_class] = 'older'
51
+ WillPaginateRenderers.pagination_options[:gmail_oldest_class] = 'oldest'
52
+ WillPaginateRenderers.pagination_options[:gmail_window_class] = 'window'
53
+
12
54
  ### Twitter
13
55
 
14
- ![](http://img.skitch.com/20101022-gsii3yq94kex2f2tgwnwuf1k8j.jpg)
56
+ **Preview**:
15
57
 
16
- ## Usage
58
+ ![](http://img.skitch.com/20101022-gsii3yq94kex2f2tgwnwuf1k8j.jpg)
17
59
 
18
- will_paginate_renderers requires the development version of will_paginate,
19
- which is currently 3.0.pre2
60
+ **Usage**:
20
61
 
21
- ### Rails 3
62
+ will_paginate(@posts, :renderer => WillPaginateRenderers::Twitter)
22
63
 
23
- **Gemfile**
64
+ #### Customization
24
65
 
25
- gem 'will_paginate_renderers'
66
+ You can change the label and CSS class of the "More" link.
26
67
 
27
- **Views**
68
+ WillPaginateRenderers.pagination_options[:twitter_label] = "View More"
28
69
 
29
- # Use the Twitter renderer
30
- will_paginate(@posts, :renderer => WillPaginateRenderers::Twitter.new)
70
+ WillPaginateRenderers.pagination_options[:twitter_class] = 'custom_css'
31
71
 
32
72
  ## Note on Patches/Pull Requests
33
73
 
@@ -37,6 +77,10 @@ which is currently 3.0.pre2
37
77
  * Push
38
78
  * Pull Request
39
79
 
80
+ Please feel free to fork and add your own renderers. Be sure to send a pull
81
+ request when you're done! If you're not able or willing to add one yourself,
82
+ feature requests are more than welcome; just open a new issue.
83
+
40
84
  ## Copyright
41
85
 
42
86
  Copyright (c) 2010 Robert Speicher. See LICENSE for details.
@@ -46,19 +46,19 @@ module WillPaginateRenderers
46
46
  end
47
47
 
48
48
  def newer
49
- return unless @collection.previous_page
50
-
51
- previous_or_next_page(@collection.previous_page,
52
- WillPaginateRenderers.pagination_options[:gmail_newer_label],
53
- WillPaginateRenderers.pagination_options[:gmail_newer_class])
49
+ if previous_page = @collection.current_page > 1 && @collection.current_page - 1
50
+ previous_or_next_page(previous_page,
51
+ WillPaginateRenderers.pagination_options[:gmail_newer_label],
52
+ WillPaginateRenderers.pagination_options[:gmail_newer_class])
53
+ end
54
54
  end
55
55
 
56
56
  def older
57
- return unless @collection.next_page
58
-
59
- previous_or_next_page(@collection.next_page,
60
- WillPaginateRenderers.pagination_options[:gmail_older_label],
61
- WillPaginateRenderers.pagination_options[:gmail_older_class])
57
+ if next_page = @collection.current_page < @collection.total_pages && @collection.current_page + 1
58
+ previous_or_next_page(next_page,
59
+ WillPaginateRenderers.pagination_options[:gmail_older_label],
60
+ WillPaginateRenderers.pagination_options[:gmail_older_class])
61
+ end
62
62
  end
63
63
 
64
64
  def oldest
@@ -24,11 +24,11 @@ module WillPaginateRenderers
24
24
  protected
25
25
 
26
26
  def next_page
27
- return unless @collection.next_page
28
-
29
- previous_or_next_page(@collection.next_page,
30
- WillPaginateRenderers.pagination_options[:twitter_label],
31
- WillPaginateRenderers.pagination_options[:twitter_class])
27
+ if next_page = @collection.current_page < @collection.total_pages && @collection.current_page + 1
28
+ previous_or_next_page(next_page,
29
+ WillPaginateRenderers.pagination_options[:twitter_label],
30
+ WillPaginateRenderers.pagination_options[:twitter_class])
31
+ end
32
32
  end
33
33
  end
34
34
  end
@@ -1,3 +1,3 @@
1
1
  module WillPaginateRenderers
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency "will_paginate", "3.0.pre2"
22
+ s.add_dependency "will_paginate", "3.0.pre4"
23
23
  s.add_development_dependency "mocha", "~> 0.9"
24
- s.add_development_dependency "rspec", "~> 2.0.0"
24
+ s.add_development_dependency "rspec", "~> 2.6"
25
25
  s.add_development_dependency "yard"
26
26
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: will_paginate_renderers
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
4
+ prerelease:
5
+ version: 0.0.2
11
6
  platform: ruby
12
7
  authors:
13
8
  - Robert Speicher
@@ -15,69 +10,52 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-10-23 00:00:00 -04:00
13
+ date: 2011-07-26 00:00:00 -04:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
22
17
  name: will_paginate
23
- prerelease: false
24
18
  requirement: &id001 !ruby/object:Gem::Requirement
25
19
  none: false
26
20
  requirements:
27
21
  - - "="
28
22
  - !ruby/object:Gem::Version
29
- hash: -1876988247
30
- segments:
31
- - 3
32
- - 0
33
- - pre2
34
- version: 3.0.pre2
23
+ version: 3.0.pre4
35
24
  type: :runtime
25
+ prerelease: false
36
26
  version_requirements: *id001
37
27
  - !ruby/object:Gem::Dependency
38
28
  name: mocha
39
- prerelease: false
40
29
  requirement: &id002 !ruby/object:Gem::Requirement
41
30
  none: false
42
31
  requirements:
43
32
  - - ~>
44
33
  - !ruby/object:Gem::Version
45
- hash: 25
46
- segments:
47
- - 0
48
- - 9
49
34
  version: "0.9"
50
35
  type: :development
36
+ prerelease: false
51
37
  version_requirements: *id002
52
38
  - !ruby/object:Gem::Dependency
53
39
  name: rspec
54
- prerelease: false
55
40
  requirement: &id003 !ruby/object:Gem::Requirement
56
41
  none: false
57
42
  requirements:
58
43
  - - ~>
59
44
  - !ruby/object:Gem::Version
60
- hash: 15
61
- segments:
62
- - 2
63
- - 0
64
- - 0
65
- version: 2.0.0
45
+ version: "2.6"
66
46
  type: :development
47
+ prerelease: false
67
48
  version_requirements: *id003
68
49
  - !ruby/object:Gem::Dependency
69
50
  name: yard
70
- prerelease: false
71
51
  requirement: &id004 !ruby/object:Gem::Requirement
72
52
  none: false
73
53
  requirements:
74
54
  - - ">="
75
55
  - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
56
  version: "0"
80
57
  type: :development
58
+ prerelease: false
81
59
  version_requirements: *id004
82
60
  description: A collection of renderers for use with will_paginate.
83
61
  email:
@@ -118,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
96
  requirements:
119
97
  - - ">="
120
98
  - !ruby/object:Gem::Version
121
- hash: 3
99
+ hash: 2460186266921804942
122
100
  segments:
123
101
  - 0
124
102
  version: "0"
@@ -127,14 +105,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
105
  requirements:
128
106
  - - ">="
129
107
  - !ruby/object:Gem::Version
130
- hash: 3
108
+ hash: 2460186266921804942
131
109
  segments:
132
110
  - 0
133
111
  version: "0"
134
112
  requirements: []
135
113
 
136
114
  rubyforge_project: will_paginate_renderers
137
- rubygems_version: 1.3.7
115
+ rubygems_version: 1.6.2
138
116
  signing_key:
139
117
  specification_version: 3
140
118
  summary: A collection of renderers for use with will_paginate