The vertical_timeline_rails
integrates the Vertical Timeline library with the Rails assets pipeline.
This gem is compatible with Rails 3.1.1 and higher (including Rails 4).
Add vertical_timeline_rails
to your Gemfile
:
# Gemfile
gem 'vertical-timeline-rails'
Then run $ bundle install
.
You can also install it yourself as:
$ gem install vertical-timeline-rails
You need to add JavaScript and stylesheet from Vertical Timeline this way:
/* app/assets/stylesheets/application.css */
/*
* ...
*= require vertical-timeline
* ...
*/
// app/assets/javascripts/application.js
// ...
//= require vertical-timeline
// ...
Vertical Timeline provides a few SVG files from Nucleo Library. If you want to use them, don't forget to add SVG files to your precompile configuration :
# config/initializers/assets.rb
# ...
Rails.application.config.assets.precompile += %w( *.svg )
# ...
You must provide a title (String
), a date (Date
), an image (String
) and a block.
<%= timeline_container('Awesome title', Date.today, 'cd-icon-picture.svg') do %>
<p>Lorem ipsum dolor sit amet.</p>
<%= link_to 'See item', '#', class: 'cd-read-more' %>
<% end %>
@TODO
Yes, I will write tests.
[0.1.0] 2015-06-19: First version and readme for instructions.
- Fork it ( https://github.com/rhannequin/vertical-timeline-rails/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request