i want the pagination to look like this "1 prev5<< prev< 6 next> next5>> 50"
1 means first page
50 means last page
6 means current page
so i customized the code somewhat like below in config/initializers/ PaginationListLinkRenderer (created new file to customize)
module WillPaginate
class PaginationListLinkRenderer < LinkRenderer
def to_html
links = []
links.unshift page_link_or_span(1, 'disabled first_page', 1)
links.push page_link_or_span(@collection.previous_page - 4, 'disabled prev5_page', @options[:previous])
links.push page_link_or_span(@collection.previous_page, 'disabled prev_page', @options[:previous_label])
links.push page_link_or_span(@collection.current_page, 'current')
links.push page_link_or_span(@collection.next_page, 'disabled next_page', @options[:next_label])
links.push page_link_or_span(@collection.next_page + 4, 'disabled next5_page', @options[:next])
links.push page_link_or_span(@collection.total_pages, 'disabled last_page', @collection.total_pages)
html = links.join(@options[:separator])
html = html.html_safe if html.respond_to? :html_safe
@options[:container] ? @template.content_tag(:div, html, html_attributes) : html
end
end
end
it is throwing error when i click on first page and last page link ...
showing error that u have defined nil object and
{"page"=>"1"}
only Parameters is passed
can anyone help me where i have gone wrong
and i have posted code in http://pastie.org/pastes/1099607