rails2.3.5+will_paginate 2.3.15支持bootstrap的Rend...

def will_paginate_with_bootstrap(collection = nil, options = {})
    options[:renderer] = BootstrapLinkRenderer
    options[:container] = false
    will_paginate(collection,options)
  end

  class BootstrapLinkRenderer < WillPaginate::LinkRenderer
    def initialize
      @gap_marker = '<li class="disabled"><a href="#">...</a></li>'
    end
    protected

    def page_link(page, text, attributes = {})
      html = @template.link_to text, url_for(page), attributes
      "<li> #{html} </li>"
    end

    def page_span(page, text, attributes = {})
      html = @template.link_to text, '#'
      "<li class=\"active\"> #{html} </li>"
    end
  end

你可能感兴趣的:(rails2.3.5+will_paginate 2.3.15支持bootstrap的Rend...)