will_paginate的默认属性有:
@@pagination_options = {
:class => 'pagination',
:previous_label => '« Previous',
:next_label => 'Next »',
:inner_window => 4, # links around the current page
:outer_window => 1, # links around beginning and end
:separator => ' ', # single space is friendly to spiders and non-graphic browsers
:param_name => :page,
:params => nil,
:renderer => 'WillPaginate::LinkRenderer',
:page_links => true,
:container => true
}
改变方法有三:
1、找到
【C:\Ruby\lib\ruby\gems\1.8\gems\will_paginate-2.3.14\lib\will_paginate\view_helpers.rb】
改上面例出的默认属性。
优点:一劳永逸,任何此机器上的项目全改掉了
缺点:换个运行环境,就失效了。
2、在【yourapp\config\environment.rb】中加入:
WillPaginate::ViewHelpers.pagination_options[:class] = "yourclass"
WillPaginate::ViewHelpers.pagination_options[:previous_label] = "前一页"
WillPaginate::ViewHelpers.pagination_options[:next_label] = "后一页"
...
...
3、如果你闲得蛋疼,你也可以自定义tag:
def will_paginate_tag(kgroup, klass)
html = []
html << will_paginate(kgroup, :previous_label => '上一页', :next_label => '下一页', :class => klass)
content_tag("div", html.join(" "))
end
分享到:
相关推荐
will_paginate-bootstrap, 将 Twitter Bootstrap 分页组件与will_paginate集成 will_paginate-bootstrap不再维护我不再使用 Bootstrap 来使用 Rails,所以不幸的是,我不再接受请求请求或者维护这个库。 为了发布你...
rails 分页插件will_paginate 2.2.2
will_paginate分页插件 博文链接:https://foxgst.iteye.com/blog/168489
rails 分页插件will_paginate 2.1.0
rails 分页插件will_paginate
NULL 博文链接:https://liuyi-act-buaa-edu-cn.iteye.com/blog/506503
cd will_paginate_endless_scroll_example 安装依赖: bundle install 迁移和种子数据库: bundle exec rake db:migrate db:seed 就是这样,它准备好了。 跑步: 像普通的 rails 应用程序一样运行: rails s ...
gem 'will_paginate-bootstrap4' 用法 <%= will_paginate @clients, renderer: WillPaginate::ActionView::BootstrapLinkRenderer %> 以下选项可用(除了will_paginate中可用的选项之外): :list_classes ...
因为需要安装svn比较麻烦,就直接手工下载了
新版本的will_paginate已经抛弃了这样的做法,转而使用gem的方式,本文通过建立一个名为foobar的应用来了解一下will_paginate的用法。 ============================== C:\>rails foobar -d mysql C:\>cd foobar C:\...
will_paginate will_paginate是一个分页库,与Ruby on Rails,Sinatra,Hanami :: View,Merb,DataMapper和Sequel集成。 安装: ## Gemfile for Rails 3+, Sinatra, and Merbgem 'will_paginate' , '~> 3.1.0' 有关...
资源分类:Python库 所属语言:Python 资源全名:mkdocs_paginate_plugin-0.0.3-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
安装:##用于Rails 3 +,Sinatra和Merb的Gemfile gem'will_paginate','〜> will_paginate will_paginate是与Ruby on Rails,Sinatra,Hanami :: View,Merb,DataMapper和Sequel集成的分页库。 安装:##用于Rails 3...
=== Will Paginate App请参阅链接: ://richonrails.com/articles/getting-started-with-will-paginate了解更多信息。
示例排序的应用程序您需要此应用程序的sqlite3。Linux sudo apt-get install sqlite3sudo apt-get install libsqlite3-devMac OSX brew install sqlite然后git clone git://github....
概述这个 gem 提供了用于渲染... 这是渲染组件的样子安装将此行添加到应用程序的 Gemfile 中: gem 'did_paginate'然后执行: $ bundle install用法要呈现分页组件,您应该使用did_paginate助手 <%= did_pagi
python库。 资源全名:flask-paginate-0.4.4.zip