Skip to content
Newer
Older
100644 108 lines (71 sloc) 3.74 KB
8ee293e Bunch of nice stuff: bugfix, docs, cleanup, test/console.
mislav authored Jun 14, 2007
1 = WillPaginate
0b4efe6 Initial WillPaginate import
pj authored Feb 5, 2007
2
c7ec4a5 Will Paginate docs and contributors
mislav authored Sep 27, 2007
3 Pagination is just limiting the number of records displayed. Why should you let
e757537 Will Paginate: add support for custom renderers. Polish the API for W…
mislav authored Dec 25, 2007
4 it get in your way while developing, then? This plugin makes magic happen. Did
5 you ever want to be able to do just this on a model:
0b4efe6 Initial WillPaginate import
pj authored Feb 5, 2007
6
805b0e6 Stress out the importance of the :order parameter when paginating models
mislav authored Jan 28, 2008
7 Post.paginate :page => 1, :order => 'created_at DESC'
0b4efe6 Initial WillPaginate import
pj authored Feb 5, 2007
8
e757537 Will Paginate: add support for custom renderers. Polish the API for W…
mislav authored Dec 25, 2007
9 ... and then render the page links with a single view helper? Well, now you
c19a3dd Will Paginate README loving
mislav authored Jan 3, 2008
10 can.
11
1cc5730 @mislav clean up README; point people to examples/index.html
authored Apr 7, 2008
12 Some resources to get you started:
88b1ccb Updated readme
pj authored Feb 6, 2007
13
48d409a @mislav RDoc love (now live at http://mislav.caboo.se/static/will_paginate/doc/)
authored Aug 14, 2008
14 * {Installation instructions}[http://github.com/mislav/will_paginate/wikis/installation]
15 on {the wiki}[http://github.com/mislav/will_paginate/wikis]
3334327 @mislav add gemspec file. change rake manifest to auto-update the gemspec. ge…
authored Apr 26, 2008
16 * Your mind reels with questions? Join our
17 {Google group}[http://groups.google.com/group/will_paginate].
48d409a @mislav RDoc love (now live at http://mislav.caboo.se/static/will_paginate/doc/)
authored Aug 13, 2008
18 * {How to report bugs}[http://github.com/mislav/will_paginate/wikis/report-bugs]
623ffdc @mislav Document the availability of tarballs
authored Mar 4, 2008
19
312aa63 Will Paginate: stop using config/boot.rb for loading Rails framework …
mislav authored Dec 25, 2007
20
e757537 Will Paginate: add support for custom renderers. Polish the API for W…
mislav authored Dec 25, 2007
21 == Example usage
88b1ccb Updated readme
pj authored Feb 6, 2007
22
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
23 Use a paginate finder in the controller:
0b4efe6 Initial WillPaginate import
pj authored Feb 5, 2007
24
3334327 @mislav add gemspec file. change rake manifest to auto-update the gemspec. ge…
authored Apr 26, 2008
25 @posts = Post.paginate_by_board_id @board.id, :page => params[:page], :order => 'updated_at DESC'
88b1ccb Updated readme
pj authored Feb 6, 2007
26
c7ec4a5 Will Paginate docs and contributors
mislav authored Sep 27, 2007
27 Yeah, +paginate+ works just like +find+ -- it just doesn't fetch all the
28 records. Don't forget to tell it which page you want, or it will complain!
29 Read more on WillPaginate::Finder::ClassMethods.
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
30
31 Render the posts in your view like you would normally do. When you need to render
32 pagination, just stick this in:
33
3334327 @mislav add gemspec file. change rake manifest to auto-update the gemspec. ge…
authored Apr 26, 2008
34 <%= will_paginate @posts %>
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
35
48d409a @mislav RDoc love (now live at http://mislav.caboo.se/static/will_paginate/doc/)
authored Aug 13, 2008
36 You're done. (You can find the option list at WillPaginate::ViewHelpers.)
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
37
38 How does it know how much items to fetch per page? It asks your model by calling
c19a3dd Will Paginate README loving
mislav authored Jan 3, 2008
39 its <tt>per_page</tt> class method. You can define it like this:
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
40
3334327 @mislav add gemspec file. change rake manifest to auto-update the gemspec. ge…
authored Apr 26, 2008
41 class Post < ActiveRecord::Base
42 cattr_reader :per_page
43 @@per_page = 50
44 end
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
45
46 ... or like this:
47
3334327 @mislav add gemspec file. change rake manifest to auto-update the gemspec. ge…
authored Apr 26, 2008
48 class Post < ActiveRecord::Base
49 def self.per_page
50 50
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
51 end
3334327 @mislav add gemspec file. change rake manifest to auto-update the gemspec. ge…
authored Apr 26, 2008
52 end
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
53
c19a3dd Will Paginate README loving
mislav authored Jan 3, 2008
54 ... or don't worry about it at all. WillPaginate defines it to be <b>30</b> by default.
55 But you can always specify the count explicitly when calling +paginate+:
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
56
3334327 @mislav add gemspec file. change rake manifest to auto-update the gemspec. ge…
authored Apr 26, 2008
57 @posts = Post.paginate :page => params[:page], :per_page => 50
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
58
8ee293e Bunch of nice stuff: bugfix, docs, cleanup, test/console.
mislav authored Jun 14, 2007
59 The +paginate+ finder wraps the original finder and returns your resultset that now has
60 some new properties. You can use the collection as you would with any ActiveRecord
c19a3dd Will Paginate README loving
mislav authored Jan 3, 2008
61 resultset. WillPaginate view helpers also need that object to be able to render pagination:
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
62
3334327 @mislav add gemspec file. change rake manifest to auto-update the gemspec. ge…
authored Apr 26, 2008
63 <ol>
64 <% for post in @posts -%>
65 <li>Render `post` in some nice way.</li>
66 <% end -%>
67 </ol>
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
68
3334327 @mislav add gemspec file. change rake manifest to auto-update the gemspec. ge…
authored Apr 26, 2008
69 <p>Now let's render us some pagination!</p>
70 <%= will_paginate @posts %>
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
71
c19a3dd Will Paginate README loving
mislav authored Jan 3, 2008
72 More detailed documentation:
73
74 * WillPaginate::Finder::ClassMethods for pagination on your models;
75 * WillPaginate::ViewHelpers for your views.
76
c7ec4a5 Will Paginate docs and contributors
mislav authored Sep 27, 2007
77
5721240 @mislav add Rick Olson to contributors
authored Apr 7, 2008
78 == Authors and credits
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
79
c19a3dd Will Paginate README loving
mislav authored Jan 3, 2008
80 Authors:: Mislav Marohnić, PJ Hyett
81 Original announcement:: http://errtheblog.com/post/929
82 Original PHP source:: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php
138f004 Will Paginate Christmas doc love
mislav authored Dec 25, 2007
83
84 All these people helped making will_paginate what it is now with their code
c314477 @mislav add Lourens Naudé to contributors
authored Apr 3, 2008
85 contributions or just simply awesome ideas:
138f004 Will Paginate Christmas doc love
mislav authored Dec 25, 2007
86
87 Chris Wanstrath, Dr. Nic Williams, K. Adam Christensen, Mike Garey, Bence
88 Golda, Matt Aimonetti, Charles Brian Quinn, Desi McAdam, James Coglan, Matijs
c314477 @mislav add Lourens Naudé to contributors
authored Apr 3, 2008
89 van Zuijlen, Maria, Brendan Ribera, Todd Willey, Bryan Helmkamp, Jan Berkel,
dd5cba2 @mislav remove gem dependency to activesupport; release 2.3.4
authored Sep 16, 2008
90 Lourens Naudé, Rick Olson, Russell Norris, Piotr Usewicz, Chris Eppstein,
91 Denis Barushev, Ben Pickles.
079d0d8 Awesome new features, supersmart tests, great coverage!
mislav authored May 9, 2007
92
1cc5730 @mislav clean up README; point people to examples/index.html
authored Apr 7, 2008
93
34b3fee Will Paginate README: related reading about pagination
mislav authored Dec 25, 2007
94 == Usable pagination in the UI
0b4efe6 Initial WillPaginate import
pj authored Feb 5, 2007
95
1cc5730 @mislav clean up README; point people to examples/index.html
authored Apr 7, 2008
96 There are some CSS styles to get you started in the "examples/" directory. They
48d409a @mislav RDoc love (now live at http://mislav.caboo.se/static/will_paginate/doc/)
authored Aug 13, 2008
97 are {showcased online here}[http://mislav.caboo.se/static/will_paginate/].
34b3fee Will Paginate README: related reading about pagination
mislav authored Dec 25, 2007
98
99 More reading about pagination as design pattern:
100
48d409a @mislav RDoc love (now live at http://mislav.caboo.se/static/will_paginate/doc/)
authored Aug 13, 2008
101 * {Pagination 101}[http://kurafire.net/log/archive/2007/06/22/pagination-101]
102 * {Pagination gallery}[http://www.smashingmagazine.com/2007/11/16/pagination-gallery-examples-and-good-practices/]
103 * {Pagination on Yahoo Design Pattern Library}[http://developer.yahoo.com/ypatterns/parent.php?pattern=pagination]
5721240 @mislav add Rick Olson to contributors
authored Apr 7, 2008
104
3334327 @mislav add gemspec file. change rake manifest to auto-update the gemspec. ge…
authored Apr 26, 2008
105 Want to discuss, request features, ask questions? Join the
106 {Google group}[http://groups.google.com/group/will_paginate].
107
Something went wrong with that request. Please try again.