Sha256: 0ba4f66447f178f7e7b64b09bcdaa4e46445959af5582fef85e7fb547da447be

Contents?: true

Size: 893 Bytes

Versions: 7

Compression:

Stored size: 893 Bytes

Contents

if defined?(WillPaginate)
  module WillPaginate
    module ActionView
      def will_paginate(collection = nil, options = {})
        options[:renderer] ||= BootstrapLinkRenderer
        super(collection, options).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 previous_or_next_page(page, text, classname)
          tag :li, link(text, page || '#'), :class => [classname[0..3], classname, ('disabled' unless page)].join(' ')
        end

        def gap
          tag :li, link(super, '#'), :class => 'disabled'
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tj_bootstrap_helper-0.0.9 config/initializers/bootstrap_will_paginate.rb
tj_bootstrap_helper-0.0.8 config/initializers/bootstrap_will_paginate.rb
tj_bootstrap_helper-0.0.7 config/initializers/bootstrap_will_paginate.rb
tj_bootstrap_helper-0.0.6 config/initializers/bootstrap_will_paginate.rb
tj_bootstrap_helper-0.0.5 config/initializers/bootstrap_will_paginate.rb
tj_bootstrap_helper-0.0.4 config/initializers/bootstrap_will_paginate.rb
tj_bootstrap_helper-0.0.3 config/initializers/bootstrap_will_paginate.rb