Kaminari - 可定制強大的Rails 3分頁器

jopen 11年前發布 | 25K 次閱讀 Rails 3 Ruby開發

Kaminari是一個基于范圍&引擎,簡潔、強大,可定制和復雜的Rails 3分頁器。它具有以下特性:

Clean

Does not globally pollute Array, Hash, Object orAR::Base.

Easy to use

Just bundle the gem, then your models are ready to be paginated. No configuration required. Don’t have to define anything in your models or helpers.

Simple scope-based API

Everything is method chainable with less “Hasheritis”. You know, that’s the Rails 3 way. No special collection class or anything for the paginated values, instead using a general AR::Relation instance. So, of course you can chain any other conditions before or after the paginator scope.

Customizable engine-based I18n-aware helper

As the whole pagination helper is basically just a collection of links and non-links, Kaminari renders each of them through its own partial template inside the Engine. So, you can easily modify their behaviour, style or whatever by overriding partial templates.

ORM & template engine agnostic

Kaminari supports multiple ORMs (ActiveRecord, Mongoid, MongoMapper) multiple web frameworks (Rails, Sinatra), and multiple template engines (ERB, Haml).

Modern

The pagination helper outputs the HTML5 <nav> tag by default. Plus, the helper supports Rails 3 unobtrusive Ajax.

項目主頁:http://www.baiduhome.net/lib/view/home/1356229239604

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!