class Leaf::ViewHelpers::ListRenderer

Public Instance Methods

html_container(html) click to toggle source
# File lib/leaf/view_helpers/list_renderer.rb, line 24
def html_container(html)
  tag(:div, "\n  " + 
    tag(:ul, html + "\n  ") + "\n", container_attributes) + "\n"
end
previous_or_next_page(page, text, classname) click to toggle source
# File lib/leaf/view_helpers/list_renderer.rb, line 16
def previous_or_next_page(page, text, classname)
  if page
    link(tag(:span, text), page, :class => classname)
  else
    tag(:span, tag(:span, text), :class => classname + ' disabled')
  end
end
to_html() click to toggle source
# File lib/leaf/view_helpers/list_renderer.rb, line 6
def to_html
  html = pagination.map do |item|
    "\n    " + tag(:li, (item.is_a?(Fixnum) ?
      page_number(item) :
      send(item)))
  end.join(@options[:separator])
  
  @options[:container] ? html_container(html) : html
end

Private Instance Methods

page_number(page) click to toggle source
# File lib/leaf/view_helpers/list_renderer.rb, line 30
def page_number(page)
  unless page == current_page
    link(tag(:span, page), page, :rel => rel_value(page))
  else
    tag(:em, tag(:span, page))
  end
end