-
if @report %div{ style: 'text-align: center' }
- if @previous %a{ href: url(@previous) } %span.glyphicon.glyphicon-chevron-left %h1{ style: 'display: inline; padding: 0em 1em;' }= @title || @report[:description] - if @next %a{ href: url(@next) } %span.glyphicon.glyphicon-chevron-right
content{ style: 'align: center; margin: auto; padding: 1em; width: 95%;' }
#placeholder{ style: 'align: center; height: 75%; margin: auto; padding: 1em; width: 95%;' }
footer
%span#legend{ style: 'float: left; padding-bottom: 1em;' } - if @report[:txt] %span#accordion{ style: 'float: right; padding-bottom: 5em;' } %span= @report[:txt]
:javascript
data_url = "#{ url(@data_url) }"; $(document).ready( function() { var options = { bars: { show: true }, grid: { hoverable: true }, legend: { container: $('#legend') }, points: { show: true }, series: { stack: true }, tooltip: true, tooltipOpts: { content: '%s %y' }, xaxis: { labelWidth: 3, mode: 'categories', tickDecimals: 0, tickSize: 1 }, yaxis: { tickDecimals: 0, } }; var data = []; function onDataReceived(series) { if ( 'undefined' == typeof series.data || ( series.data instanceof Array && 0 == series.data.length ) ) { $('#placeholder').html("<p style='color: red' alignment='center'>No data available for this time period</p>"); } else { $.plot( "#placeholder", series.data.sort( function(a,b) { return b.total - a.total } ), options ); $( "#accordion" ).accordion( { active: false, collapsible: true } ); // XXX } } $.ajax({ url: data_url, type: 'GET', dataType: 'json', success: onDataReceived }); });