%# sort hash by keys %>
<% @deleted_message_daygroups.sort.reverse.each do |day, messages| %>
<%= day.in_time_zone(admin_user.timezone).strftime('%F') %>
<% messages.sort_by{|msg| msg.created_at}.reverse.each do |msg| %>
<% cssclass = [] %>
<% cssclass.push msg.sender == @user ? 'sent' : 'received' %>
<% if msg.body[/-----BEGIN/] %>
<% cssclass.push 'encrypted' %>
<% else %>
<% cssclass.push 'plaintext' %>
<% end %>
<%= msg.body.split("\r\n").collect{ |line| h line}.join("
").html_safe %>
<%# The above message is printed on one long line in the source code with no newline chars.
This allows copying PGP messages correctly while using the break-word styling in Firefox.
Chrome doesn't have the copy problem that Firefox has. %>
<% end %>
<%# daygroup %>
<% end %>