revamp saved search implementation

This commit is contained in:
r888888888
2017-03-15 15:36:48 -07:00
parent 79c0dc3647
commit da06bee0ab
24 changed files with 307 additions and 257 deletions

View File

@@ -1,37 +1,38 @@
<div id="c-saved-searches">
<div id="a-index">
<h1>Saved Searches</h1>
<h1>
Saved Searches
<% if params[:label] %>
(<%= params[:label] %>)
<% end %>
</h1>
<% @categories.each do |category, saved_searches| %>
<h2>
<% if category.present? %>
<%= link_to_if SavedSearch.posts_search_available?, category.tr("_", " "), posts_path(:tags => "search:#{category}") %>
(<%= link_to "rename", new_saved_search_category_change_path(:old => category) %>)
<% else %>
<%= link_to_if SavedSearch.posts_search_available?, SavedSearch::UNCATEGORIZED_NAME, posts_path(:tags => "search:#{SavedSearch::UNCATEGORIZED_NAME}") %>
<% end %>
</h2>
<table class="striped" width="100%">
<thead>
<tr>
<th width="80%">Tags</th>
<th width="20%"></th>
<table class="striped" width="100%">
<thead>
<tr>
<th width="60%">Query</th>
<th 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>
</thead>
<tbody>
<% saved_searches.each do |saved_search| %>
<tr id="saved-search-<%= saved_search.id %>">
<td><%= link_to saved_search.tag_query, posts_path(:tags => saved_search.tag_query) %></td>
<td>
<%= link_to "edit", edit_saved_search_path(saved_search) %>
| <%= link_to "delete", saved_search_path(saved_search), :method => :delete, :remote => true %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>