saved searches: add 'created' and 'posts' columns to index page.
This commit is contained in:
@@ -41,6 +41,11 @@ class SavedSearch < ApplicationRecord
|
|||||||
(REDIS_EXPIRY.to_i - ttl).seconds.ago
|
(REDIS_EXPIRY.to_i - ttl).seconds.ago
|
||||||
end
|
end
|
||||||
memoize :refreshed_at
|
memoize :refreshed_at
|
||||||
|
|
||||||
|
def cached_size
|
||||||
|
SavedSearch.redis.scard("search:#{query}")
|
||||||
|
end
|
||||||
|
memoize :cached_size
|
||||||
end
|
end
|
||||||
|
|
||||||
concerning :Labels do
|
concerning :Labels do
|
||||||
|
|||||||
@@ -18,7 +18,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th data-sort="string">Query</th>
|
<th data-sort="string">Query</th>
|
||||||
<th data-sort="string">Labels</th>
|
<th data-sort="string">Labels</th>
|
||||||
<th>Last Refreshed</th>
|
<th>Posts</th>
|
||||||
|
<th>Refreshed</th>
|
||||||
|
<th>Created</th>
|
||||||
<th class="links"></th>
|
<th class="links"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -32,6 +34,7 @@
|
|||||||
<%= link_to label, posts_path(:tags => "search:#{label}") %>
|
<%= link_to label, posts_path(:tags => "search:#{label}") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
<td><%= ss.cached_size if ss.cached_size > 0 %></td>
|
||||||
<td>
|
<td>
|
||||||
<% if ss.refreshed_at.present? %>
|
<% if ss.refreshed_at.present? %>
|
||||||
<%= time_ago_in_words_tagged ss.refreshed_at %>
|
<%= time_ago_in_words_tagged ss.refreshed_at %>
|
||||||
@@ -39,6 +42,7 @@
|
|||||||
><%= SavedSearch::REDIS_EXPIRY.inspect %> ago
|
><%= SavedSearch::REDIS_EXPIRY.inspect %> ago
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
<td><%= time_ago_in_words_tagged ss.created_at %></td>
|
||||||
<td class="links">
|
<td class="links">
|
||||||
<%= link_to "edit", edit_saved_search_path(ss) %>
|
<%= link_to "edit", edit_saved_search_path(ss) %>
|
||||||
| <%= link_to "delete", saved_search_path(ss), :method => :delete, :remote => true %>
|
| <%= link_to "delete", saved_search_path(ss), :method => :delete, :remote => true %>
|
||||||
|
|||||||
Reference in New Issue
Block a user