Will_paginate prev next链接意外行为

时间:2015-01-09 05:29:07

标签: ruby-on-rails will-paginate

我只想为下一个/上一页应用自定义样式

但它的工作方式很棒。

单击下一个链接后,上一个链接消失,反之亦然。

link => http://great-compassion.com:1234/news/index

will_pagination的片段

def page_number(page)
  unless page == current_page
    tag(:li, link(page, page, :rel => rel_value(page)))
  else
    tag(:li, page, :class => "current")
  end
end

def previous_or_next_page(page, text, classname)
  if page
    tag(:li, link(text, page), :class => classname)
  else
    tag(:li, text, :class => classname + ' disabled')
  end
end

def html_container(html)
  tag(:ul, html, container_attributes)
end

1 个答案:

答案 0 :(得分:0)

以前的链接实际上存在于html中。您可以通过检查页面内容来查看它。此外,您可以将鼠标悬停在1旁边,然后点击Previous page,即使您看不到它。

Screen shot of the inspected page

应用了样式 - 特别是text-indent: -9999px;使其不可见。将text-indent的值更改为0或10会使其显示。

罪魁祸首造型来自custom.css

.pagenum .previous_page a {
  padding-left: 0;
  width: 20px;
  height: 20px;
  background-image: url(/assets/images/listbtn.png) -40px 0px;
  display: block;
  text-indent: -9999px;
}
相关问题