1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<% form_for @message, :url => user_messages_path(@user), :html => { :multipart => true } do |f| %>
  <tr>
    <% if @reply_to.nil? %>
    <td width="100"><p class="labels">To:</p></td>
    <td><%= f.text_field :to %>
      <%= error_message_on @message, :to %></td>
    <% else %>
    <td width="100">To: <%= @message.to %><%= f.hidden_field :to, :value => @message.to  %></td>
    <% end %>
  </tr>
  <tr>
  <% if @reply_to.nil? %>
    <td width="100"><p class="labels">Patient:</p></td>
  <td><%= f.collection_select :patient_id, Patient.find_all_by_user_id(current_user), :id, :last_name %>
    <%= error_message_on @message, :patient_id %></td>
  <% else %>
    <td width="100">Patient: <%= Patient.find(@message.patient_id).last_name %><%= f.hidden_field :patient_id, :value => @message.patient_id  %></td>
  <% end %>
  </tr>
  <tr>
  <% if @reply_to.nil? %>
    <td width="100"><p class="labels">Subject:</p></td>
    <td><%= f.text_field :subject %>
    <%= error_message_on @message, :subject %></td>
  <% else %>
    <td width="100">Subject: <%= @message.subject %><%= f.hidden_field :subject, :value => @message.subject  %></td>
  <% end %>
  </tr>
  <tr>
      <td width="100" valign="top"><p class="labels">Message:</p></td>
      <td><%= f.text_area :body %>
      <%= error_message_on @message, :body %></td>
  </tr>
  <tr>
    <td width="100" valign="top"><p class="labels">Attachment:</p></td>
    <td><%= f.file_field :attachment %><%= error_message_on @message, :attachment %></td>
  </tr>
  <tr>
      <td colspan="2"><%= submit_tag "Send" %></td>
  </tr>
</table>