Module: MobilePagination::Templates

Included in:
Paginate
Defined in:
lib/mobile_pagination/templates.rb

Instance Method Summary collapse

Instance Method Details

#first_page_htmlObject



4
5
6
7
8
# File 'lib/mobile_pagination/templates.rb', line 4

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


38
39
40
41
42
# File 'lib/mobile_pagination/templates.rb', line 38

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

#htmlObject



28
29
30
31
32
33
34
35
36
# File 'lib/mobile_pagination/templates.rb', line 28

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

#last_page_htmlObject



22
23
24
25
26
# File 'lib/mobile_pagination/templates.rb', line 22

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

#next_page_htmlObject



16
17
18
19
20
# File 'lib/mobile_pagination/templates.rb', line 16

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

#previous_page_htmlObject



10
11
12
13
14
# File 'lib/mobile_pagination/templates.rb', line 10

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