module WillPaginateSemanticUi::GenericRenderer

Constants

GAP

Public Instance Methods

to_html() click to toggle source
# File lib/will_paginate_semantic_ui/generic_renderer.rb, line 5
def to_html
  list_items = pagination.map do |item|
    item.class == Fixnum ? page_number(item) : send(item)
  end.join(@options[:link_separator])

  tag("div", list_items, class: ul_class)
end

Protected Instance Methods

gap() click to toggle source
# File lib/will_paginate_semantic_ui/generic_renderer.rb, line 30
def gap
  tag("div", GAP, class: "disabled item")
end
next_page() click to toggle source
# File lib/will_paginate_semantic_ui/generic_renderer.rb, line 39
def next_page
  num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
  previous_or_next_page(num, "right")
end
page_number(page) click to toggle source
# File lib/will_paginate_semantic_ui/generic_renderer.rb, line 15
def page_number(page)
  classLink = "item"
  classLink += " active" if page == current_page
  link(page, page, {class: classLink})
end
previous_or_next_page(page, classname) click to toggle source
# File lib/will_paginate_semantic_ui/generic_renderer.rb, line 21
def previous_or_next_page(page, classname)
  classLink = "icon item"
  unless page
    tag(:a, tag("i", "", class: "#{classname} chevron icon"), class: classLink + " disabled")
  else
    link(tag("i", "", class: "#{classname} chevron icon"), page, {class: classLink})
  end
end
previous_page() click to toggle source
# File lib/will_paginate_semantic_ui/generic_renderer.rb, line 34
def previous_page
  num = @collection.current_page > 1 && @collection.current_page - 1
  previous_or_next_page(num, "left")
end
ul_class() click to toggle source
# File lib/will_paginate_semantic_ui/generic_renderer.rb, line 44
def ul_class
  ["pagination ui menu", @options[:class]].compact.join(" ")
end