Prev | Current Page 140 | Next

David Berube

"Practical Reporting with Ruby and Rails"

Updater("chart",
'/performance'+
'/' + $('game_id').value +
'/' + $('player_id').value,
{evalScripts:true,
method:'get',
onComplete:function(){
setTimeout("$('chart').show();",
400); }
}
);
CHAPTER 5 n CONNECTING YOUR REPORTS TO THE WORLD 96
}
}
Event.observe("player_id", "change", show_report);
Event.observe("game_id", "change", show_report);

The code shown in Listing 5-18 goes in app/views/performance/show.html.erb.
Listing 5-18. Performance Controller Show HTML View (app/views/performance/
show.html.erb)
<%if @events.length>1%>

<% graph_params = { 'AllowScriptAccess'=>'SameDomain' } %>
<%=flashobject_tag "/flash/open-flash-chart.swf",
:size=>"850x400",
:parameters=>graph_params,
:variables=>{'data'=>"/performance/#{@game.id}
/#{@player.id}.text"} %>

<%else%>

<%=@player.name%> has no recorded data for <%=@game.name%>.


<%end%>
The code shown in Listing 5-19 goes in app/views/layouts/show.text.erb.
Listing 5-19. Performance Controller Show Text View (app/views/performance/show.


Pages:
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
Rowy noclegi męskie skarpetki rowerowe wycieczki do Skandynawii pity mapa Niemiec