Sha256: 76f43bb65def1d2af7a00e34ccf84dea91181ac440fd538a293d03acd8a895ea

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

module MobilePagination
  module Templates

    def first_page_html
      generate_pagination_link title: 'First Page',
                               href: first_page_link,
                               text: 'First Page'
    end

    def previous_page_html
      generate_pagination_link title: 'Previous Page',
                               href: previous_page_link,
                               text: 'Previous Page'
    end

    def next_page_html
      generate_pagination_link title: 'Next Page',
                               href: next_page_link,
                               text: 'Next Page'
    end

    def last_page_html
      generate_pagination_link title: 'Last Page',
                               href: last_page_link,
                               text: 'Last Page'
    end

    def html
      return '' unless should_paginate?
      ''.tap do |markup|
        markup << first_page_html    if display_first_page?
        markup << previous_page_html if display_previous_page?
        markup << next_page_html     if display_next_page?
        markup << last_page_html     if display_last_page?
      end
    end

    def generate_pagination_link(opts)
      "<li>
        <a title='#{opts[:title]}' href='#{opts[:href]}'>#{opts[:text]}</a>
      </li>"
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mobile_pagination-0.0.9 lib/mobile_pagination/templates.rb