Sha256: ce5697f8bedb11930252fb973b463198c327996c0d8420333295770506df246b

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

module RailsPaginate::Renderers
  # normale renderer
  class HtmlDefault < Base


    def render
      view.content_tag(:ul) do
        html = "\n"
        html += content_tag(:li, :class => "first_page") do
          link_to_page collection.first_page, 'paginate.first_page_label'
        end
        html += "\n"
        html += content_tag(:li, :class => "previous_page") do
          link_to_page collection.previous_page, 'paginate.previous_page_label'
        end

        html += render_pages

        html += "\n"
        html += content_tag(:li, :class => "next_page") do
          link_to_page collection.next_page, 'paginate.next_page_label'
        end
        html += "\n"
        html += content_tag(:li, :class => "last_page") do
          link_to_page collection.last_page, 'paginate.last_page_label'
        end
        html += "\n"
        html.html_safe
      end
    end

    def render_pages
      html = ""

      pager.visible_pages.each do |page|
        html += "\n"
        html += content_tag(:li, :class => "pager") do
          link_to_page page, page.nil? ? nil : 'paginate.pager'
        end
      end
      html += "\n"
      html.html_safe
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_paginate-0.0.3 lib/rails_paginate/renderers/html_default.rb