Sha256: 6aa0dad1dd8f5c84c71edad3cd9e4f298d3ba6a4a26ddf74264b1e2a06da1525
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require "foundation_pagination/version" module FoundationPagination # Contains functionality shared by all renderer classes. module FoundationRenderer def to_html list_items = pagination.map do |item| case item when Fixnum page_number(item) else send(item) end end.join(@options[:link_separator]) if @options[:foundation].to_i >= 3 tag("ul", list_items, class: "pagination #{@options[:class]}") else html_container(tag("ul", list_items)) end end def html_container(html) tag(:ul, html, container_attributes) end def container_attributes super.except(*[:link_options]) end protected def page_number(page) link_options = @options[:link_options] || {} tag :li, link(page, page, link_options.merge(rel: rel_value(page))), :class => ('current' if page == current_page) end def gap tag :li, link('…', '#'), :class => 'unavailable' end # def previous_page # num = @collection.current_page > 1 && @collection.current_page - 1 # previous_or_next_page(num, @options[:previous_label], "prev") # end # def next_page # num = @collection.current_page < @collection.total_pages && @collection.current_page + 1 # previous_or_next_page(num, @options[:next_label], "next") # end def previous_or_next_page(page, text, classname) link_options = @options[:link_options] || {} tag :li, link(text, page || '#', link_options), :class => [classname[0..3], classname, ('unavailable' unless page)].join(' ') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
will_paginate-foundation-0.3.1 | lib/foundation_pagination/foundation_renderer.rb |