Sha256: 20df848e3cd4fb27434e08f9ba9a3a646cf73da35a936c5d03dc534baed0daea
Contents?: true
Size: 1.2 KB
Versions: 5
Compression:
Stored size: 1.2 KB
Contents
require 'timeline' module TimelineHelper # Include the javscript for the simile timeline def timeline_includes render :partial => 'shared/timeline_include' end # Create a new timeline. Example: # timeline('tl', # theme => 'ClassicTheme' # startDate => '1900-01-01' # stopDate => '2000-01-01' # url => '.' # bands => [{ # intervalUnit => 'DECADE', # intervalPixels => 100, # date => '1900-01-01', # layout => 'original' # # syncWith => 0, # # highlight => true # }], # data => { ...timeline data... } # ) # # You can set the :only_with_data option if you want no timeline for an # empty dataset def timeline(timeline_element, options) raise(ArgumentError, 'Must pass an option hash here') unless(options.is_a?(Hash)) options.to_options! only_data = options.delete(:only_with_data) data = options.delete(:data) options[:timelineElement] = timeline_element timeline = Timeline.new(:config => options, :data => data) return '' if(timeline.empty? && only_data) render(:partial => 'shared/timeline', :object => timeline, :locals => { :element_id => timeline_element }) end end
Version data entries
5 entries across 5 versions & 1 rubygems