Sha256: 09b0a9149933fece1ce5c61d8091586a641307f5b78df4a32740d74a9169a42f
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
# extends will_paginate to play well with Twitter's Bootstrap require 'will_paginate/view_helpers/action_view' module WillPaginate module ActionView def will_paginate(collection = nil, options = {}) options, collection = collection, nil if collection.is_a? Hash collection ||= infer_collection_from_controller options[:renderer] ||= BootstrapLinkRenderer super.try :html_safe end class BootstrapLinkRenderer < LinkRenderer protected def html_container(html) tag :div, tag(:ul, html), container_attributes end def page_number(page) tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page) end def gap tag :li, link(super, '#'), :class => 'disabled' end def previous_or_next_page(page, text, classname) tag :li, link(text, page || '#'), :class => [(classname[0..3] if @options[:page_links]), (classname if @options[:page_links]), ('disabled' unless page)].join(' ') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems