Rubyでページング機能を追加するGem「will_paginate」の使い方をメモ。
・Home · mislav/will_paginate Wiki
・Translating will_paginate output (i18n) · mislav/will_paginate Wiki
・will_paginate | RubyGems.org | your community gem host
・Rails 3 + will_paginate 3.0.pre2でAjax対応なリンクを生成する | TechRacho
・Ruby on Rails 3でwill_paginateを使ってみた。 - cys b
■ オプション一覧
# ==== Options
# * :class -- CSS class name for the generated DIV (default: "pagination")
# * :previous_label -- default: "« Previous"
# * :next_label -- default: "Next »"
# * :page_links -- when false, only previous/next links are rendered (default: true)
# * :inner_window -- how many links are shown around the current page (default: 4)
# * :outer_window -- how many links are around the first and the last page (default: 1)
# * :link_separator -- string separator for page HTML elements (default: single space)
# * :param_name -- parameter name for page number in URLs (default: :page)
# * :params -- additional parameters when generating pagination links
# (eg. :controller => "foo", :action => nil)
# * :renderer -- class name, class or instance of a link renderer (default in Rails:
# WillPaginate::ActionView::LinkRenderer)
# * :page_links -- when false, only previous/next links are rendered (default: true)
# * :container -- toggles rendering of the DIV container for pagination links, set to
# false only when you are rendering your own pagination markup (default: true)
・will_paginate/lib/will_paginate/view_helpers.rb at master · mislav/will_paginate
・will_paginateのオプション設定でpaginationの外観を変更する方法 - memo.yomukaku.net
・will_paginateヘルパーのオプション覚書 - screw it!
i18n対応だけど、ここで初期値をセットしておくと楽。
■ config/locales/will_paginate.ja.yml
ja:
will_paginate:
previous_label: "<"
next_label: ">"
page_gap: "..."
・Roll your own pagination links with will_paginate – UK Specialists in Ruby on Rails, Exalead, AWS, Consultancy