Prev | Current Page 342 | Next

David Berube

"Practical Reporting with Ruby and Rails"

Training Log Uploader
Let??™s look at the important parts of the code.
CHAPTER 12 n CREATING REPORTS WITH RUBY AND MICROSOFT OFFICE 247
Dissecting the Code
The log controller has two methods. The first controls uploading new logs. Let??™s examine
its associated view (Listing 12-5):
<%@title='Upload Training Log'
number_of_elements_displayed = 10
%>
<% form_tag do %>

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


These two input controls are used to set the TrainingClass (that is, either Practical
Exopaleontology or Pro Quantum Ethnology) and the date for the rest of the form. The
date control uses the calendar_date_select helper, which creates a regular text box with
a button to select the date using a drop-down calendar.
The rest of the view is concerned with creating the individual rows to enter trainee
grades:


<%1.


Pages:
330331332333334335336337338339340341 342 343344345346347348349350351352353354
Wczasy nad morzemzakłady bukmacherskiePompy zanurzenioweprofesjonalne wizualizacje 3daquilamed
Trainee Name Trainee Employer Grade