https://github.com/alexwayfer/flame-pagination
Pagination for Flame application with Formalism forms.
https://github.com/alexwayfer/flame-pagination
Last synced: over 1 year ago
JSON representation
Pagination for Flame application with Formalism forms.
- Host: GitHub
- URL: https://github.com/alexwayfer/flame-pagination
- Owner: AlexWayfer
- License: mit
- Created: 2020-07-09T20:56:05.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-04-23T18:00:26.000Z (about 2 years ago)
- Last Synced: 2024-04-23T20:08:42.237Z (about 2 years ago)
- Language: Ruby
- Size: 63.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Flame Pagination
[](https://cirrus-ci.com/github/AlexWayfer/flame-pagination)
[](https://codecov.io/gh/AlexWayfer/flame-pagination)
[](https://codeclimate.com/github/AlexWayfer/flame-pagination)
[](https://depfu.com/repos/github/AlexWayfer/flame-pagination)
[](https://inch-ci.org/github/AlexWayfer/flame-pagination)
[](https://github.com/AlexWayfer/flame-pagination/blob/main/LICENSE.txt)
[](https://rubygems.org/gems/flame-pagination)
Pagination for Flame application with Formalism forms.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'flame-pagination'
```
And then execute:
```shell
bundle install
```
Or install it yourself as:
```shell
gem install flame-pagination
```
## Usage
Recommended to use only as dependency of
[`formalism-model_forms`](https://github.com/AlexWayfer/formalism-model_forms).
You'll still have to include `Flame::Pagination::ForController` into your model controller.
Details below:
```ruby
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](https://github.com/AlexWayfer/gem_toys#release).
## Contributing
Bug reports and pull requests are welcome on [GitHub](https://github.com/AlexWayfer/flame-pagination).
## License
The gem is available as open source under the terms of the
[MIT License](https://opensource.org/licenses/MIT).