Skip to content

phatworx/rails_paginate

Repository files navigation

rails_paginate

a new rails 3 paginate plugin as will_paginate replacement

Features

  • Collection support

    • Array

    • ActiveRecord

  • View helper for pagination

  • Renderer

    • HTML list renderer (:html_default)

  • Pager

    • Slider

  • I18n support

Installation

add to Gemfile

gem "rails_paginate"

after bundle execute

rails g rails_paginate:install

Configuration

RailsPaginate.setup do |config|
  # config.per_page = 20
  # config.page_param = :page

  # configure default renderer
  # config.default_renderer = :html_default

  # configure renderer
  # config.renderer :html_default do |renderer|
    # renderer.show_first_page = false
    # renderer.show_last_page = false
    # renderer.show_next_page = false
    # renderer.show_previous_page = false
  # end

  # configure default default_pager
  # config.default_pager = :slider

  # configure pager
  # config.pager :slider do |pager|
    # pager.inner = 3
    # pager.outer = 1
  # end
end

Using

ActiveRecord

@collection = User.order(:login).where(:active => 1).paginate :page => 1, :per_page => 10

Array

@collection = (1..555).to_a.paginate :page => 1, :per_page => 10

View

# default
paginate @collection

# with class
paginate @collection, :class => "super"

# with class
paginate @collection, :class => "super"

# with ajax
paginate @collection, :remote => true, :method => :get

Requirements

Test environments

  • ruby-1.9.2

  • ruby-1.8.7

  • ree-1.8.7

  • jruby-1.5.6

Maintainers

Contributing to rails_paginate

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Marco Scholl. See LICENSE.txt for further details.

About

a rails 3 paginate plugin as will_paginate replacement

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages