<table class="data zebra moderations" width="100%" cellspacing=0>
<tr>
  <th>Date/Time</th>
  <th>Moderator</th>
  <th>Story/Comment/User/Tag/Category, Action, Reason</th>
</tr>
<% moderations.each do |mod| %>
  <tr class="nobottom <%= mod.moderator && 'mod' %>">
    <td>
      <%= mod.created_at.strftime("%Y-%m-%d %H:%M") %></td>
    <td>
      <% if mod.moderator %>
      <a href="/messages?to=<%= mod.moderator.try(:username) %>"><%=
        mod.moderator.try(:username) %></a>
      <% elsif mod.is_from_suggestions? %>
        <em>(Users)</em>
      <% end %></td>
    <td><% if mod.story %>
        <a href="<%= mod.story.comments_path %>">Story: <%= mod.story.title
          %></a>
      <% elsif mod.comment %>
        <a href="<%= mod.comment.path %>">Comment by
          <%= mod.comment.user.username %>
          on
          <%= mod.comment.story.title %></a>
      <% elsif mod.tag %>
        <%= link_to("Tag: #{mod.tag.tag}", mod.tag) %>
      <% elsif mod.category %>
        <%= link_to("Category: #{mod.category.category}", mod.category) %>
      <% elsif mod.user_id %>
        <% if mod.user %>
          <%= link_to "User #{mod.user.username}", mod.user %>
        <% else %>
          User <%= mod.user_id %> (Deleted)
        <% end %>
      <% elsif mod.domain %>
        Domain <%= link_to mod.domain.domain,  domain_path(mod.domain) %>
      <% end %></td>
  </tr>
  <tr class="<%= mod.reason.present?? "nobottom" : "" %>">
    <td colspan=2></td>
    <td class="wrap">Action: <em><%= mod.action %></em></td>
  </tr>
  <% if mod.reason.present? %>
    <tr>
      <td colspan=2></td>
      <td>Reason: <em><%= mod.reason %></em></td>
    </tr>
  <% end %>
<% end %>
</table>
