If the user doesn??™t have Flash installed, you should display
a message stating that Flash is required to see the content. Additionally, if you use
EMBED tags, Internet Explorer requires users to click Flash objects to activate them and display
their content, which is annoying. The Flash Object plug-in will take care of both
problems. It will check if Flash is installed, and if not, it will display the message. The
plug-in also inserts the objects dynamically, which avoids the Internet Explorer click-toactivate
issue.
Next, let??™s take a look at the last view, app/views/performance/show.text.erb
(Listing 5-19):
<%
labels = @events.map { |e| e[:event] }
values = @events.map { |e| e[:average_time] }
min = 0
max = values.max
%>
First, you loop through the @events array and pull out the event and average_time
from each element. The events are used as labels; the average time is used as values. Note
that this code is in here and not in the controller to keep their concerns separate. You
could pass the labels and values directly to the view, but that would require the controller
code to embody knowledge of how Open Flash Chart works, which would violate MVC
CHAPTER 5 n CONNECTING YOUR REPORTS TO THE WORLD 106
separation.
Pages:
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165