timelineJS-rails
This gem packages the TimelineJS for easy use with the Rails asset pipleine.
General Installation
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
:
Add the CSS to application.css
Language
The Localization language default is en
English,
if you want to change it, just add the Javascript to application.js
:
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
Font Themes
If you want to set the font theme, just add the CSS to application.css
:
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
Example
$(document).ready(function() {
createStoryJS({
type: 'timeline',
width: '400',
height: '500',
source: '/events.json',
embed_id: 'time_line'
});
});
<%= timeline_config(
embed_id: "timeline_id",
source: '/events.json',
height: '600',
lang: 'zh-cn',
font: 'Bevan-PotanoSans'
)
%>
Thanks
License
www.opensource.org/licenses/MIT