Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kiote/activeadmin-poro-decorator
Active Admin with ability to use Plain Old Ruby Object's decorators
https://github.com/kiote/activeadmin-poro-decorator
Last synced: about 7 hours ago
JSON representation
Active Admin with ability to use Plain Old Ruby Object's decorators
- Host: GitHub
- URL: https://github.com/kiote/activeadmin-poro-decorator
- Owner: kiote
- License: mit
- Created: 2014-11-26T09:52:31.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-12-19T11:28:41.000Z (almost 7 years ago)
- Last Synced: 2024-11-09T16:26:59.475Z (11 days ago)
- Language: Ruby
- Size: 523 KB
- Stars: 6
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Activeadmin Poro Decorator
![](https://travis-ci.org/kiote/activeadmin-poro-decorator.svg?branch=master)
Alternative for draper, if you need decorators at ActiveAdmin (and Rails).
Active Admin uses the Draper gem for [decorators](http://activeadmin.info/docs/11-decorators.html), but sometimes you don't need that.
For reasons you could read this article: http://thepugautomatic.com/2014/03/draper.See discussion of PORO with Active Admin authors [here](https://github.com/activeadmin/activeadmin/issues/3600).
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'activeadmin-poro-decorator'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install activeadmin-poro-decorator
Then run rake-task to copy config file:
$ rake config:copy
Finally, rename activeadmin-poro-decorator.yml.sample to activeadmin-poro-decorator.yml:
$ mv config/activeadmin-poro-decorator.yml.example config/activeadmin-poro-decorator.yml
## Usage
```ruby
# app/admin/post.rb
ActiveAdmin.register Post do
decorate_with PostDecoratorpermit_params :title
index do
column :id
column :title
column :hello #delegated
column :link_title #delegated
end
end# app/presenters/post_decorator.rb
class PostDecorator < DelegateClass(Post)
include ActiveadminPoroDecoratordef hello
"Hello, #{title}"
enddef link_title
helpers.link_to(id, url_helpers.admin_post_path(self))
end
end
```For more examples have a look to [sample app](https://github.com/kiote/aa_plus_poro)
## Credits
![](http://d3a5orex94acl6.cloudfront.net/assets/logo-sprites-a6de3b3521c14ee436ca3207d83cdf90.png)Activeadmin-poro-decorator is created with support of [Legelisten.no](http://www.legelisten.no/om-oss)
## Contributing
1. Fork it ( https://github.com/[my-github-username]/activeadmin-poro-decorator/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request