class TrustyCms::Pagination::LinkRenderer
def initialize(url_stem)
def initialize(url_stem) @url_stem = url_stem end
def page_link(page, text, attributes = {})
this is rather crude compared to the WillPaginate link-builder,
def page_link(page, text, attributes = {}) linkclass = %{ class="#{attributes[:class]}"} if attributes[:class] linkrel = %{ rel="#{attributes[:rel]}"} if attributes[:rel] param_name = WillPaginate::ViewHelpers.pagination_options[:param_name] %{<a href="#{@url_stem}?#{param_name}=#{page}"#{linkrel}#{linkclass}>#{text}</a>} end
def page_span(_page, text, attributes = {})
def page_span(_page, text, attributes = {}) %{<span class="#{attributes[:class]}">#{text}</span>} end
def to_html
def to_html links = @options[:page_links] ? windowed_links : [] links.unshift page_link_or_span(@collection.previous_page, 'disabled prev_page', @options[:previous_label]) links.push page_link_or_span(@collection.next_page, 'disabled next_page', @options[:next_label]) html = links.join(@options[:separator]) @options[:container] ? %{<div class="pagination">#{html}</div>} : html end