79 lines
2.4 KiB
Plaintext
79 lines
2.4 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">View Received</a>
|
|
<% else %>
|
|
<a href="/messages/sent">View Sent</a>
|
|
<% end %>
|
|
</div>
|
|
<div class="legend">
|
|
Private Messages
|
|
<% if @direction == :out %>
|
|
Sent
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if @messages.any? %>
|
|
<%= form_with url: batch_delete_messages_path do |f| %>
|
|
<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 ? "From" : "To" %></th>
|
|
<th width="17%"><%= @direction == :in ? "Received" : "Sent" %></th>
|
|
<th width="60%">Subject</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>
|
|
<div style="white-space:nowrap;">
|
|
<% if @direction == :in %>
|
|
<% if message.author %>
|
|
<a href="/u/<%= message.author.username %>"><%=
|
|
message.author.username %></a>
|
|
<% else %>
|
|
<%= message.author_username %>
|
|
<% end %>
|
|
<%= message.hat.to_html_label if message.hat %>
|
|
<% else %>
|
|
<a href="/u/<%= message.recipient.username %>"><%=
|
|
message.recipient.username %></a>
|
|
<% end %>
|
|
</div>
|
|
</td>
|
|
<td><%= time_ago_in_words_label(message.created_at) %></td>
|
|
<td><a href="/messages/<%= message.short_id %>"><%= message.subject
|
|
%></a></td>
|
|
</tr>
|
|
<% end %>
|
|
</table>
|
|
<p>
|
|
<%= f.submit "Delete Selected" %>
|
|
</p>
|
|
<% end %>
|
|
<% else %>
|
|
<p>
|
|
You do not have any <%= @direction == :in ? "" : "sent" %> private
|
|
messages.
|
|
</p>
|
|
<% end %>
|
|
|
|
<br>
|
|
|
|
<div class="legend">
|
|
Compose Message
|
|
</div>
|
|
|
|
<%= render partial: 'form', locals: { new_message: @new_message, replying: false } %>
|
|
</div>
|