will_paginate bootstrap
class BootstrapListLinkRenderer < WillPaginate::ActionView::LinkRenderer | |
protected | |
def page_number(page) | |
unless page == current_page | |
tag(:li, link(page, page, :rel => rel_value(page))) #设定非当前分页的页码链接 | |
else | |
tag(:li, tag(:a, page, :href => "#"), :class => 'active') #设定当前分页的页码链接 | |
end | |
end | |
def gap | |
text = @template.will_paginate_translate(:page_gap) { '…' } | |
%(<li class="disabled"><a href="#">#{text}</a></li>) #设定gap | |
end | |
def previous_or_next_page(page, text, classname) | |
if page | |
tag(:li, link(text, page, :class => classname)) #设定"上一页"和"下一页"可以使用的的链接 | |
else | |
tag(:li, tag(:a, text, :href => "#"), | |
:class =>'disabled') #设定"上一页"和"下一页"不可用的链接 | |
end | |
end | |
def html_container(html) | |
tag(:div, tag(:ul, html), container_attributes) #加入ul标签 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment