Skip to content

Instantly share code, notes, and snippets.

@KellyMahan
Created September 1, 2011 19:12
Show Gist options
  • Select an option

  • Save KellyMahan/1186989 to your computer and use it in GitHub Desktop.

Select an option

Save KellyMahan/1186989 to your computer and use it in GitHub Desktop.

Revisions

  1. KellyMahan created this gist Sep 1, 2011.
    31 changes: 31 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    <%= form_for @timesheet do |f| %>
    <% if @timesheet.errors.any? %>
    <div class="error_messages">
    <h2>Form is invalid</h2>
    <ul>
    <% for message in @timesheet.errors.full_messages %>
    <li><%= message %></li>
    <% end %>
    </ul>
    </div>
    <% end %>

    <%= f.hidden_field :user_id, :value => current_user.id %>
    <%= f.hidden_field :start_date, :value => @date %>

    <table style="width: 30%">
    <tr>
    <th style="text-align: left">Date</th>
    <th style="text-align: left; width: 10%">Hours</th>
    </tr>
    <tbody>
    <%= f.fields_for :workdays, @timesheet.workdays do |g| %>
    <td><%= g.collection_select :entry_date, week_array(@date), :to_date, :to_s, :prompt => true %></td>
    <td><%= g.text_field :hours %></td>
    <% end %>
    </tbody>
    </table>

    <hr/>
    <p><%= f.submit "Submit" %></p>
    <% end %>