Prev | Current Page 334 | Next

David Berube

"Practical Reporting with Ruby and Rails"

find(:all).map { |c|
[c.name, c.id] } )%>
Date: <%= calendar_date_select_tag "training_class_date",
Date.today.strftime('%B %d, %Y') %>




<%1.upto(number_of_elements_displayed) do |i|%>





<%end%>
Trainee Name Trainee Employer Grade
<%=text_field "trainee", 'name',:index=>i %><%=text_field "trainee", 'employer', :index=>i %><%=text_field "trainee", 'grade', :index=>i, :size=>3, :value=>'0'%>%
<%=submit_tag 'Upload', :class=>'submit_button'%>

<%end%>
Save this as app/views/log/upload.html.erb.
The other view lets you download the data as XML, as shown in Listing 12-6.
Listing 12-6. XML Download View (app/views/log/index.xml.builder)
xml.instruct! :xml, :version=>"1.0"
xml.instruct! 'xml-stylesheet', :href=>'/stylesheets/log.css'
xml.grades do
xml.css :href=>'/stylesheets/log.css'
@grades.each do |grade|
xml.grade do
xml.id grade.id
xml.student grade.student.name
xml.employer grade.student.employer
CHAPTER 12 n CREATING REPORTS WITH RUBY AND MICROSOFT OFFICE 240
xml.


Pages:
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
szkolenia dla przedsiębiorców oferty spa Wczasy nad morzem projektowanie wnętrz opony michelin