<div id="c-tag-implications">
  <div id="a-index">
    <div class="search">
      <%= form_tag(general_search_tag_aliases_path, :method => :get) do %>
        <%= text_field_tag "query", params[:query], :value => params[:search][:name_matches] %>
        <%= submit_tag "Search Implications" %>
        <%= submit_tag "Search Aliases" %>
      <% end %>
    </div>

    <table width="100%" class="striped">
      <thead>
        <tr>
          <th width="30%">From</th>
          <th width="30%">To</th>
          <th width="10%">Reference</th>
          <th width="10%">Status</th>
          <th width="15%"></th>
        </tr>
      </thead>
      <tbody>
        <% @tag_implications.each do |tag_implication| %>
          <tr id="tag-implication-<%= tag_implication.id %>">
            <td><%= 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><%= 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 id="tag-implication-status-for-<%= tag_implication.id %>"><%= tag_implication.status %></td>
            <td>
              <% if CurrentUser.is_admin? %>
                <%= link_to "Delete", tag_implication_path(tag_implication), :remote => true, :method => :delete, :confirm => "Are you sure you want to delete this implication?" %>
                <% if tag_implication.is_pending? %>
                  | <%= link_to "Approve", approve_tag_implication_path(tag_implication), :remote => true, :method => :post %>
                <% end %>
              <% end %>
            </td>
          </tr>
        <% end %>
      </tbody>
    </table>

    <%= numbered_paginator(@tag_implications) %>
  </div>
</div>

<%= render "secondary_links" %>

<% content_for(:page_title) do %>
  Tag Implications - <%= Danbooru.config.app_name %>
<% end %>
