use will paginate, added renderer for bootstrap
This commit is contained in:
parent
3f26c0e3d7
commit
fe65058624
2 changed files with 21 additions and 1 deletions
2
Gemfile
2
Gemfile
|
|
@ -105,7 +105,7 @@ gem 'typhoeus'
|
||||||
gem 'haml'
|
gem 'haml'
|
||||||
gem 'mobile-fu'
|
gem 'mobile-fu'
|
||||||
gem 'sass'
|
gem 'sass'
|
||||||
gem 'bootstrap-will_paginate'
|
gem 'will_paginate'
|
||||||
gem 'client_side_validations'
|
gem 'client_side_validations'
|
||||||
|
|
||||||
# web
|
# web
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,25 @@ module WillPaginate
|
||||||
def will_paginate(collection = nil, options = { :renderer => WillPaginate::ActionView::LinkRenderer } )
|
def will_paginate(collection = nil, options = { :renderer => WillPaginate::ActionView::LinkRenderer } )
|
||||||
super.try :html_safe
|
super.try :html_safe
|
||||||
end
|
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 gap
|
||||||
|
tag :li, link(super, '#'), :class => 'disabled'
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue