revamp saved search implementation
This commit is contained in:
@@ -8,12 +8,11 @@
|
||||
<%= hidden_field_tag "saved_search_tags", params[:tags] %>
|
||||
|
||||
<div class="input">
|
||||
<label>
|
||||
<%= text_field_tag "saved_search_category", "", :placeholder => "Category" %>
|
||||
</label>
|
||||
<label for="saved_search_labels">Label</label>
|
||||
<%= text_field_tag "saved_search_labels", "" %>
|
||||
</div>
|
||||
|
||||
<p><label><%= check_box_tag "saved_search_disable_categories" %> Disable categorization</label></p>
|
||||
<p><label><%= check_box_tag "saved_search_disable_labels" %> Disable labels</label></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,6 +1,6 @@
|
||||
<% content_for(:secondary_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Gallery", posts_path(:tags => "search:all") %></li>
|
||||
<li><%= link_to "Listing", saved_searches_path %></li>
|
||||
<li><%= link_to "View posts", posts_path(:tags => "search:all") %></li>
|
||||
<li><%= link_to "Manage saved searches", saved_searches_path %></li>
|
||||
</menu>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<% if @saved_search.errors.any? %>
|
||||
Danbooru.error("<%= j @saved_search.errors.full_messages.join(', ') %>");
|
||||
<% else %>
|
||||
Danbooru.notice("Search '<%= j @saved_search.tag_query %>' was saved");
|
||||
Danbooru.notice("Search '<%= j @saved_search.query %>' was saved");
|
||||
<% end %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Danbooru.notice("Search '<%= j @saved_search.tag_query %>' was deleted");
|
||||
Danbooru.notice("Search '<%= j @saved_search.query %>' was deleted");
|
||||
$("#saved-searches-nav").html("<%= j render('saved_searches/interface', :saved_searches => CurrentUser.user.saved_searches) %>");
|
||||
Danbooru.Post.initialize_saved_searches();
|
||||
$("#saved-search-<%= @saved_search.id %>").remove();
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
<%= error_messages_for :saved_search %>
|
||||
|
||||
<%= simple_form_for(@saved_search) do |f| %>
|
||||
<%= f.input :tag_query %>
|
||||
<%= f.input :category %>
|
||||
<%= f.button :submit, :data => { :disable_with => "Submitting..." } %>
|
||||
<%= f.input :query %>
|
||||
<%= f.input :label_string, :label => "Labels", :hint => "A list of tags to help categorize this search. Space delimited." %>
|
||||
<%= f.button :submit, :value => "Submit", :data => { :disable_with => "Submitting..." } %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user