Kaminari - 可定制强大的Rails 3分页器

jopen 12年前

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.open-open.com/lib/view/home/1356229239604