Guest User

Untitled

a guest
Nov 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. # config/initializers/will_paginate.rb
  2.  
  3. module WillPaginate
  4. module ActionView
  5. def will_paginate(collection = nil, options = {})
  6. options[:renderer] ||= BootstrapLinkRenderer
  7. super.try :html_safe
  8. end
  9.  
  10. class BootstrapLinkRenderer < LinkRenderer
  11. protected
  12.  
  13. def html_container(html)
  14. tag :div, tag(:ul, html), container_attributes
  15. end
  16.  
  17. def page_number(page)
  18. tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
  19. end
  20.  
  21. def previous_or_next_page(page, text, classname)
  22. tag :li, link(text, page || '#'), :class => [classname[0..3], classname, ('disabled' unless page)].join(' ')
  23. end
  24.  
  25. def gap
  26. tag :li, link(super, '#'), :class => 'disabled'
  27. end
  28. end
  29. end
  30. end
Add Comment
Please, Sign In to add comment