Sha256: e6ed75f76b7d7744a7bceb276ba1d806771a544fb9a6e5875bb0726574919468

Contents?: true

Size: 803 Bytes

Versions: 6

Compression:

Stored size: 803 Bytes

Contents

# -*- encoding : utf-8 -*-
# config/initializers/will_paginate.rb
# from gist https://gist.github.com/1182136

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails-bootstrap-engine-0.0.9 config/initializers/will_paginate.rb
rails-bootstrap-engine-0.0.8 config/initializers/will_paginate.rb
rails-bootstrap-engine-0.0.5 config/initializers/will_paginate.rb
rails-bootstrap-engine-0.0.4 config/initializers/will_paginate.rb
rails-bootstrap-engine-0.0.3 config/initializers/will_paginate.rb
rails-bootstrap-engine-0.0.2 config/initializers/will_paginate.rb