From ff80bea0c26509accfcbc01b5b7f7c54359a63e8 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 30 Jan 2015 17:25:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Kaminari=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E5=B9=B6=E7=BB=99=E5=87=BA=E4=BA=86?= =?UTF-8?q?=E6=AF=94=E8=BE=83=E8=AF=A6=E7=BB=86=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/initializers/kaminari_config.rb | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 config/initializers/kaminari_config.rb diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb new file mode 100644 index 000000000..63e6b7f9b --- /dev/null +++ b/config/initializers/kaminari_config.rb @@ -0,0 +1,32 @@ +# Time 2015-01-30 17:04:12 +# Author lizanle +# Description kaminari配置文件 +# <%= paginate @users, :window => 2 %> +# 则展示页会像 5 6 7 8 9 ,当7是当前页的时候 + +# <%= paginate @users, :outer_window => 3 %> +# 分页展示会像 1 2 3 4 ...(snip)... 17 18 19 20 当总共有20个页面的时候 + +# <%= paginate @users, :left => 1, :right => 3 %> +# 分页展示会像 1 ...(snip)... 18 19 20 当总共有20个页面的时候 + +# <%= paginate @users, :param_name => :pagina %> +# 这样子会将每个链接传进去一个参数 :pagina + +# <%= paginate @users, :params => {:controller => 'foo', :action => 'bar'} %> +# 这样子将会修改每个链接的控制器和动作. :controller and :action + +# <%= paginate @users, :remote => true %> +# 这将会使每个链接使用ajax方式,极其简单,非常完美的工作。data-remote="true" + +#更多知识详见 https://github.com/honwlee/kaminari +Kaminari.configure do |config| + # config.default_per_page = 25 + # config.max_per_page = nil + # config.window = 4 + # config.outer_window = 3 + # config.left = 0 + # config.right = 0 + # config.page_method_name = :page + # config.param_name = :page +end