# Rails Admin Featured Content
[](https://badge.fury.io/rb/rails_admin_content_builder)
[](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content)
[](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content/coverage)
[](https://codeclimate.com/github/luizpicolo/rails_admin_featured_content)
[](https://travis-ci.org/luizpicolo/rails_admin_featured_content)
An easy way for creating Featured Content using [rails_admin](https://github.com/sferik/rails_admin).
## Preview

### Demonstration
[Featured Content](https://example-cb-fc.herokuapp.com/admin/rails_admin_featured_content~featured_content/4/featured_content)
[Featured generated](https://example-cb-fc.herokuapp.com/)
## Important
First, make sure that the gem [rails_admin_content_builder](https://github.com/luizpicolo/rails_admin_content_builder) is installed and working properly.
## Installation
**Test with rails < 5 and TurboLink < 5**
Add this line to your application's Gemfile:
This is a complement to the gem rails_admin_content_builder, only works with dependencies listed in the requirements and not alone.
```ruby
gem 'owlcarousel-rails' # For slides
gem 'rails_admin_featured_content'
```
After the above step, execute:
$ bundle
Run the generator and migrations:
rails g rails_admin_featured_content
rake db:migrate
Add styles in app/assets/stylesheets/application.scss:
```ruby
*= require rails_admin_featured_content
*= require owl.carousel
*= require owl.theme
```
Add Javascript in app/assets/javascripts/application.js:
```ruby
//= require owl.carousel
```
```javascript
$(document).ready(function() {
$(".fc-slide").owlCarousel({
autoPlay: 7000,
singleItem: true,
stopOnHover: true,
slideSpeed: 500,
paginationSpeed: 500,
rewindSpeed: 1000,
navigation: true,
navigationText: ['','']
});
});
```
Also, add in view/layouts/application.html.erb (optional):
```html
```
## Usage
Include this in your controller:
```ruby
@featured = RailsAdminFeaturedContent::FeaturedContent.where(status: true).first
```
In your show featured content view:
```
<%= @featured.featured_sanitized %>
```
## Requirements
Dependencies:
MiniMagick
Rails_admin
Rails_admin_content_builder
Supported ORM:
ActiveRecord
Supported Asset Plugin:
CarrierWave
## TODO
- Tests :)
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, execute `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/luizpicolo/rails_admin_featured_content. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).