class RailsPaginate::Renderers::HtmlDefault

default html renderer

Public Instance Methods

render() click to toggle source

render html for pagination

# File lib/rails_paginate/renderers/html_default.rb, line 22
def render
  content_tag(:ul) do
    html = "\n"

    if show_first_page?
      html += content_tag(:li, :class => "first_page") do
        link_to_page collection.first_page, 'paginate.first_page_label'
      end
      html += "\n"
    end

    if show_previous_page?
      html += content_tag(:li, :class => "previous_page") do
        link_to_page collection.previous_page, 'paginate.previous_page_label'
      end
      html += "\n"
    end

    html += render_pager

    if show_next_page?
      html += content_tag(:li, :class => "next_page") do
        link_to_page collection.next_page, 'paginate.next_page_label'
      end
      html += "\n"
    end

    if show_last_page?
      html += content_tag(:li, :class => "last_page") do
        link_to_page collection.last_page, 'paginate.last_page_label'
      end
      html += "\n"
    end
    html.html_safe
  end
end
render_pager() click to toggle source

render pager

# File lib/rails_paginate/renderers/html_default.rb, line 60
def render_pager
  view.reset_cycle(:paginate)

  html = ""
  visible_pages = pager.visible_pages
  visible_pages.each do |page|
    html += content_tag(:li, :class => "pager #{visible_pages.first == page ? 'first_pager' : ''} #{visible_pages.last == page ? 'last_pager' : ''} #{view.cycle("pager_even", "pager_odd", :name => :paginate)}") do
      link_to_page page, page.nil? ? nil : 'paginate.pager'
    end
    html += "\n"
  end
  html.html_safe
end
show_first_page?() click to toggle source

show first page item?

# File lib/rails_paginate/renderers/html_default.rb, line 75
def show_first_page?
  options[:show_first_page] || self.class.show_first_page
end
show_last_page?() click to toggle source

show last page item?

# File lib/rails_paginate/renderers/html_default.rb, line 80
def show_last_page?
  options[:show_last_page] || self.class.show_last_page
end
show_next_page?() click to toggle source

show next page item?

# File lib/rails_paginate/renderers/html_default.rb, line 85
def show_next_page?
  options[:show_next_page] || self.class.show_next_page
end
show_previous_page?() click to toggle source

show previous page item?

# File lib/rails_paginate/renderers/html_default.rb, line 90
def show_previous_page?
  options[:show_previous_page] || self.class.show_previous_page
end