Flame Pagination
Pagination for Flame application with Formalism forms.
Installation
Add this line to your application's Gemfile:
gem 'flame-pagination'
And then execute:
bundle install
Or install it yourself as:
gem install flame-pagination
Usage
Recommended to use only as dependency of
formalism-model_forms
.
You'll still have to include Flame::Pagination::ForController
into your model controller.
Details below:
require 'flame-pagination'
module MyProject
## Already in `formalism-model_forms`
module Forms
module Model
## Base form for model listing
class List < Base
include Flame::Pagination::ForForms
end
end
module User
class List < Model::List
end
end
end
## Have to be set manually, maybe in some common `ModelController`
module Controlelrs
module UsersController
extend Flame::Controller::Actions
include Flame::Pagination::ForController
def index
@form = Forms::User::List.new(params[:user])
paginate! @form
@users = if (form_outcome = @form.run).success?
form_outcome.result
end
view :index
end
end
end
end
Development
After checking out the repo, run bundle install
to install dependencies.
Then, run toys rspec
to run the tests.
To install this gem onto your local machine, run toys gem install
.
To release a new version, run toys gem release %version%
.
See how it works here.
Contributing
Bug reports and pull requests are welcome on GitHub.
License
The gem is available as open source under the terms of the MIT License.