class Grasshopper::Paginate::Renderer

Protected Instance Methods

gap() click to toggle source
Calls superclass method
# File lib/grasshopper_paginate/renderer.rb, line 9
def gap
        tag :li, link(super, nil), :class => 'goto-gap'
end
html_container(html) click to toggle source
# File lib/grasshopper_paginate/renderer.rb, line 21
                def html_container(html)
                        content = tag(:ul, html, container_attributes) + goto_input
tag :div, content, class: 'grasshopper-pagination'
                end
page_number(page) click to toggle source
# File lib/grasshopper_paginate/renderer.rb, line 13
def page_number(page)
        tag :li, link(page, page, :rel => rel_value(page)), :class => ('current' if page == current_page)
end
previous_or_next_page(page, text, classname) click to toggle source
# File lib/grasshopper_paginate/renderer.rb, line 17
def previous_or_next_page(page, text, classname)
        tag :li, link(text, page || '#'), :class => [classname[0..3], classname, ('unavailable' unless page)].join(' ')
end

Private Instance Methods

goto_input() click to toggle source
# File lib/grasshopper_paginate/renderer.rb, line 28
def goto_input
  class_list = 'pagination goto hide'
  class_list += ' ajax' if @options[:ajax]
  tag :ul, page_input, class: class_list
end
input_data() click to toggle source
# File lib/grasshopper_paginate/renderer.rb, line 43
def input_data
  {
    class: 'goto-page',
    value: current_page,
    url: url('page_number'),
    total: total_pages
  }
end
page_input() click to toggle source
# File lib/grasshopper_paginate/renderer.rb, line 34
def page_input
  input = tag :input, nil, input_data
  hidden_link = tag :a, nil, class: 'hidden-link'
  input += hidden_link
  input = tag :li, input
  total_count = tag :li, tag(:a, "  /   #{total_pages}".html_safe, class: 'total-pages'), class: 'unavailable'
  previous_page + input + total_count + next_page
end