<div id="c-saved-searches">
  <div id="a-index">
    <h1>
      Saved Searches
      <% if params[:label] %>
        (<%= params[:label] %>)
      <% end %>
    </h1>

    <table class="striped" width="100%">
      <thead>
        <tr>
          <th data-sort="string" width="60%">Query</th>
          <th data-sort="string" width="20%">Labels</th>
          <th width="20%" class="links"></th>
        </tr>
      </thead>

      <tbody>
        <% @saved_searches.each do |ss| %>
          <tr id="saved-search-<%= ss.id %>">
            <td><%= link_to ss.query, posts_path(:tags => ss.query) %></td>
            <td>
              <% ss.labels.each do |label| %>
                <%= link_to label, posts_path(:tags => "search:#{label}") %>
              <% end %>          
            </td>
            <td class="links">
              <%= link_to "edit", edit_saved_search_path(ss) %>
                | <%= link_to "delete", saved_search_path(ss), :method => :delete, :remote => true %>
            </td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
</div>

<%= render "secondary_links" %>

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