This gem packages the TimelineJS for easy use with the Rails asset pipleine.
Add to the assets group in your Gemfile:
gem 'timelineJS-rails'
Install the gem:
bundle install
Add the Javascript to application.js
:
//=require js/storyjs-embed
$(document).ready(function() {
createStoryJS({
type: 'timeline',
width: '400',
height: '500',
lang: 'zh-ch',
source: '/events.json',
embed_id: 'time_line'
});
});
In the production environment and enable Rails asset pipleine, you need to do below:
Add the Javascript to application.js
:
//=require js/timeline-min
//=require js/locale/zh-ch
Add the css to application.css
:
/*
*= require css/timeline
*/
Init the timeline:
$(document).ready(function() {
createStoryJS({
type: 'timeline',
width: '400',
height: '500',
source: '/events.json',
embed_id: 'time_line',
lang: '/assets/application.js',
js: '/assets/application.js',
css: '/assets/application.css'
});
});