fixes #2220
This commit is contained in:
@@ -2,7 +2,9 @@ class SavedSearchesController < ApplicationController
|
||||
respond_to :html, :js
|
||||
|
||||
def index
|
||||
@saved_searches = saved_searches.order("name")
|
||||
@saved_searches = saved_searches.order("tag_query")
|
||||
@categories = @saved_searches.group_by{|saved_search| saved_search.category.to_s}
|
||||
@categories = @categories.sort_by{|category, saved_searches| category.to_s}
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -2,28 +2,31 @@
|
||||
<div id="a-index">
|
||||
<h1>Saved Searches</h1>
|
||||
|
||||
<table class="striped" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="80%">Tags</th>
|
||||
<th width="10%">Category</th>
|
||||
<th width="10%"></th>
|
||||
</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><%= saved_search.category %></td>
|
||||
<td>
|
||||
<%= link_to "edit", edit_saved_search_path(saved_search) %> |
|
||||
<%= link_to "delete", saved_search_path(saved_search), :method => :delete, :remote => true %>
|
||||
</td>
|
||||
<% @categories.each do |category, saved_searches| %>
|
||||
<h2><%= category.present? ? category : "Uncategorized" %></h2>
|
||||
<table class="striped" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="80%">Tags</th>
|
||||
<th width="10%">Category</th>
|
||||
<th width="10%"></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</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><%= saved_search.category %></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 %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user