Sha256: af9d881788827de4ca3142f2486178cc5dfef752d03a449ca2a34afeb2be3f5e
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
.inputs %label{:for => 'start'} Start Time %input.date-time.ui-widget.ui-corner-all{:type => 'text', :name => 'start'} %label{:for => 'stop'} Stop Time %input.date-time.ui-widget.ui-corner-all{:type => 'text', :name => 'stop'} %button View = haml :loading, layout: false #main-graph.graph :javascript // TODO find a d3 datetimepicker (or make one) // then drop jquery, jqueryui and datetimerpicker altogether (function(){ $('button').button(); var now = Date.now(); var defaults = [now - (1000 * 60 * 30), now]; $('.date-time').datetimepicker().each(function(i){ var input = $(this); var time = LocationHash.get(input.attr('name')); input.datetimepicker('setDate', new Date(time ? time * 1000 : defaults[i])); }); }()); (function(){ var main_el = d3.select('#main-graph'); var view = d3.select('button'); var inputs = d3.selectAll('.date-time')[0]; //var params = LocationHash.params(); function set_time_params(){ var map = {}; for (var i = 0, elem; elem = inputs[i]; i++) map[elem.name] = +new Date(elem.value) / 1000; LocationHash.set(map); } function render_graph(){ BatsdDash.render(main_el, LocationHash.params()); } // view button handler view.on('click', function(){ set_time_params(); render_graph(); }); // listen for changes to URL LocationHash.changed(render_graph); // initial graph render render_graph(); })();
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
batsd-dash-0.5.0 | lib/batsd-dash/views/view.haml |