<table width="100%" class="striped">
  <thead>
    <tr>
      <th width="25%">From</th>
      <th width="25%">To</th>
      <th width="10%">Reference</th>
      <th width="15%">Approver</th>
      <th width="5%">Status</th>
      <th width="15%"></th>
    </tr>
  </thead>
  <tbody>
    <% tag_implications.each do |tag_implication| %>
      <tr id="tag-implication-<%= tag_implication.id %>">
        <td class="category-<%= tag_implication.antecedent_tag.try(:category) %>"><%= link_to tag_implication.antecedent_name, posts_path(:tags => tag_implication.antecedent_name) %> <span class="count"><%= tag_implication.antecedent_tag.post_count rescue 0 %></span></td>
        <td class="category-<%= tag_implication.consequent_tag.try(:category) %>"><%= link_to tag_implication.consequent_name, posts_path(:tags => tag_implication.consequent_name) %> <span class="count"><%= tag_implication.consequent_tag.post_count rescue 0 %></span></td>
        <td>
          <% if tag_implication.forum_topic_id %>
            <%= link_to tag_implication.forum_topic_id, forum_topic_path(tag_implication.forum_topic_id) %>
          <% end %>
        </td>
        <td><%= link_to_user(tag_implication.approver) if tag_implication.approver %></td>
        <td id="tag-implication-status-for-<%= tag_implication.id %>"><%= tag_implication.status %></td>
        <td>
          <%= link_to "Show", tag_implication_path(tag_implication) %>

          <% if tag_implication.is_pending? && tag_implication.editable_by?(CurrentUser.user) %>
            | <%= link_to "Edit", edit_tag_implication_path(tag_implication) %>
          <% end %>

          <% if tag_implication.deletable_by?(CurrentUser.user) %>
            | <%= link_to "Delete", tag_implication_path(tag_implication), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this implication?"} %>
          <% end %>

          <% if CurrentUser.user.is_admin? && tag_implication.is_pending? %>
            | <%= link_to "Approve", approve_tag_implication_path(tag_implication), :remote => true, :method => :post %>
          <% end %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>