-
Notifications
You must be signed in to change notification settings - Fork 864
Link renderer
Mislav Marohnić edited this page Jan 10, 2013
·
3 revisions
If you need to customize HTML output of will_paginate
, you'll need to subclass
WillPaginate::ActionView::LinkRenderer, and pass that object with the
:renderer
option.
There is no documentation how to write your own link renderer, but the source code is pretty self-explanatory. Dive into it, and selectively override methods of the LinkRenderer to adjust them to your needs.
Happy hacking!
module ApplicationHelper
# change the default link renderer for will_paginate
def will_paginate(collection_or_options = nil, options = {})
if collection_or_options.is_a? Hash
options, collection_or_options = collection_or_options, nil
end
unless options[:renderer]
options = options.merge :renderer => MyCustomLinkRenderer
end
super *[collection_or_options, options].compact
end
end
- Installation instructions
- API documentation
- Differences between v2.3 - v3.0
- Troubleshooting or Report bugs
- Simple search functionality
- Translating output (i18n)
- Browse the source code
- See the recent commits