1 <!--
 2   This is the RHTML template for adding a run to the log. The only ruby we use in this
 3   template is to make the form generation easier - it's not actually necessary.
 4 
 5   <%% ruby code %%> is used to evaluate ruby code
 6   <%%= ruby code producing string output %%> is used to print ruby code
 7 -->
 8 <h1>Report A Run:</h1>
 9 <p>
10     <!-- 
11       we use a helper method to get a url to the correct location, and store it - later
12       we can retrieve that variable out and use it in the <form> tag's action parameter
13     -->    
14   <% formurl = url_for :controller => 'run_logger', :action => 'log_time_process' %> 
15   <form action="<%= formurl %>" method="post"> 
16     <table>
17       <tr>
18         <td>Elapsed Time:</td>
19         <!-- helper method to create text fields - runinfo is the hash, time is the key -->
20         <td><%= text_field "runinfo", "time"%></td>
21       </tr>
22       <tr>
23         <td>Run Distance:</td>
24         <td><%= text_field "runinfo", "distance" %></td>
25       </tr>
26       <tr>
27         <td>Date: </td>
28         <td>
29           <!-- helper date select methods - "runinfo[day]" corresponds to "hash[key]" in
30                the parameters -->
31           <%= select_day   Date.today, :field_name => "day" %>
32           <%= select_month Date.today, :field_name => "month" %>
33           <%= select_year  Date.today, :field_name => "year" %>
34         </td>
35       </tr>
36       <tr>
37         <td colspan="2" align="right">
38           <%= submit_tag "log run" %>
39         </td>
40       </tr>
41     </table>
42   </form>
43 </p>