journalduhacker/app/views/messages/index.html.erb
2012-08-24 11:41:34 -05:00

59 lines
1.5 KiB
Plaintext

<div class="box wide">
<div class="legend">
Private Messages
</div>
<% if @user.received_messages.any? %>
<table class="data zebra" width="100%" cellspacing=0>
<tr>
<th width="15%">From</th>
<th width="20%">Sent</th>
<th width="60%">Subject</th>
</tr>
<% @user.received_messages.each do |message| %>
<tr class="<%= message.has_been_read? ? "" : "bold" %>">
<td><a href="/u/<%= message.author.username %>"><%=
message.author.username %></a></td>
<td><%= time_ago_in_words(message.created_at) %> ago</td>
<td><a href="/messages/<%= message.short_id %>"><%= message.subject
%></a></td>
</tr>
<% end %>
</table>
<% else %>
<p>
You do not have any private messages.
</p>
<% end %>
<br>
<div class="legend">
Compose Message
</div>
<%= form_for @new_message, :method => :post do |f| %>
<%= error_messages_for @new_message %>
<div class="boxline">
<%= f.label :recipient_username, "To:", :class => "required" %>
<%= f.text_field :recipient_username, :size => 20 %>
</div>
<div class="boxline">
<%= f.label :subject, "Subject:", :class => "required" %>
<%= f.text_field :subject, :style => "width: 500px;" %>
</div>
<div class="boxline">
<%= f.label :body, "Message:", :class => "required" %>
<%= f.text_area :body, :style => "width: 500px;", :rows => 5 %>
</div>
<div class="boxline">
<p></p>
<%= submit_tag "Send Message" %>
</div>
<% end %>
</div>