Sha256: 540b36ac0dd5ed21c0ed12ea14c881050830e49a7d16503b456b94ce2e0eb56b

Contents?: true

Size: 735 Bytes

Versions: 5

Compression:

Stored size: 735 Bytes

Contents

require 'will_paginate/view_helpers/action_view'

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

5 entries across 5 versions & 1 rubygems

Version Path
flexi_generators-0.3.4 lib/generators/flexi/config/templates/will_paginate.rb
flexi_generators-0.3.3 lib/generators/flexi/config/templates/will_paginate.rb
flexi_generators-0.3.2 lib/generators/flexi/config/templates/will_paginate.rb
flexi_generators-0.3.1 lib/generators/flexi/config/templates/will_paginate.rb
flexi_generators-0.3.0 lib/generators/flexi/config/templates/will_paginate.rb