This gem packages the TimelineJS for easy use with the Rails asset pipleine.
Add to the assets group in your Gemfile:
gem 'timelineJS-rails', '~> 1.1.1'
Install the gem:
bundle install
Add the Javascript to application.js
:
//=require timelineJS/embed
Add the CSS to application.css
/*
*= require timelineJS/timeline
*/
The Localization language default is en
English,
if you want to change it, just add the Javascript to application.js
:
//=require timelineJS/locale/xxx # you should change the xxx with one of the available languages below
af
Afrikaansar
Arabic (beta)bg
Bulgarianca
Catalancz
Czechda
Danishde
German / Deutschel
Greeken
Englishen-24hr
English using 24hr timees
Spanisheu
Basque/ Euskarafi
Finnishfo
Faroesefr
Frenchgl
Galicianhu
Hungarianhy
Armenianid
Indonesianis
Icelandicit
Italianiw
Hebrew (beta)ja
Japaneseka
Georgianko
Koreanlv
Latviannl
Dutchno
Norwegianpl
Polishpt-br
Brazilian Portuguesept
Portugueseru
Russiansk
Slovaksl
Sloveniansr-cy
Serbian (Cyrillic)sr
Serbian (Latin)sv
Swedishta
Tamiltl
Tagalogtr
Turkishzh-cn
Chinesezh-tw
Taiwanese
If you want to set the font theme, just add the CSS to application.css
:
/*
*= require timelineJS/themes/font/xxx #you should change the xxx with one of the available font themes below
*/
Arvo-PTSans
Merriweather-NewsCycle
PoiretOne-Molengo
PTSerif-PTSans
DroidSerif-DroidSans
Lekton-Molengo
NixieOne-Ledger
AbrilFatface-Average
PlayfairDisplay-Muli
Rancho-Gudea
Bevan-PotanoSans
BreeSerif-OpenSans
SansitaOne-Kameron
Pacifico-Arimo
$(document).ready(function() {
createStoryJS({
type: 'timeline',
width: '400',
height: '500',
source: '/events.json', //get the events.json format from https://github.com/VeriteCo/TimelineJS#file-formats
embed_id: 'time_line'
});
});