95 lines
2.9 KiB
Plaintext
95 lines
2.9 KiB
Plaintext
<script>
|
|
$(document).ready(function() {
|
|
$("#delete_all").click(function(e) {
|
|
var table = $(e.target).closest("table");
|
|
$("td input:checkbox", table).attr("checked", e.target.checked);
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<div class="box wide">
|
|
<div class="legend" style="float: right;">
|
|
<% if @direction == :out %>
|
|
<a href="/messages"><%= t('.viewreceived') %></a>
|
|
<% else %>
|
|
<a href="/messages/sent"><%= t('.viewsent') %></a>
|
|
<% end %>
|
|
</div>
|
|
<div class="legend">
|
|
<%= t('.privatemessages') %>
|
|
<% if @direction == :out %>
|
|
<%= t('.sent') %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if @messages.any? %>
|
|
<%= form_tag batch_delete_messages_path do %>
|
|
<table class="data zebra" width="100%" cellspacing=0>
|
|
<tr>
|
|
<th width="3%"><%= check_box_tag "delete_all",
|
|
:id => "delete_all" %></th>
|
|
<th width="15%"><%= @direction == :in ? t('.from') : t('.tomsg') %></th>
|
|
<th width="17%"><%= @direction == :in ? t('.received') : t('.sent') %></th>
|
|
<th width="60%"><%= t('.subjectlabel') %></th>
|
|
</tr>
|
|
<% @messages.includes(:author, :recipient).each do |message| %>
|
|
<tr class="<%= message.has_been_read? ? "" : "bold" %>">
|
|
<td><%= check_box_tag "delete_#{message.short_id}" %></td>
|
|
<td><% if @direction == :in %>
|
|
<% if message.author %>
|
|
<a href="/u/<%= message.author.username %>"><%=
|
|
message.author.username %></a>
|
|
<% else %>
|
|
<%= message.author_username %>
|
|
<% end %>
|
|
<% else %>
|
|
<a href="/u/<%= message.recipient.username %>"><%=
|
|
message.recipient.username %></a>
|
|
<% end %></td>
|
|
<td><%= distance_of_time_in_words(message.created_at, Time.now) %></td>
|
|
<td><a href="/messages/<%= message.short_id %>"><%= message.subject
|
|
%></a></td>
|
|
</tr>
|
|
<% end %>
|
|
</table>
|
|
<p>
|
|
<%= submit_tag t('.deleteselected') %>
|
|
</p>
|
|
<% end %>
|
|
<% else %>
|
|
<p>
|
|
<%= t('.donothavemessages', :from => :in ? "" : t('.sentlower') )%>
|
|
</p>
|
|
<% end %>
|
|
|
|
<br>
|
|
|
|
<div class="legend">
|
|
<%= t('.composemessage') %>
|
|
</div>
|
|
|
|
<%= form_for @new_message, :method => :post do |f| %>
|
|
<%= error_messages_for @new_message %>
|
|
|
|
<div class="boxline">
|
|
<%= f.label :recipient_username, t('.tomsglabel'), :class => "required" %>
|
|
<%= f.text_field :recipient_username, :size => 20 %>
|
|
</div>
|
|
|
|
<div class="boxline">
|
|
<%= f.label :subject, t('.subject'), :class => "required" %>
|
|
<%= f.text_field :subject, :style => "width: 500px;" %>
|
|
</div>
|
|
|
|
<div class="boxline">
|
|
<%= f.label :body, t('.message'), :class => "required" %>
|
|
<%= f.text_area :body, :style => "width: 500px;", :rows => 5 %>
|
|
</div>
|
|
|
|
<div class="boxline">
|
|
<p></p>
|
|
<%= submit_tag t('.sendmessage') %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|