Files
danbooru/app/views/saved_searches/index.html.erb
evazion 1e80540a04 css: refactor CSS to use Tailwind-style utility classes.
Refactor CSS to use standard Tailwind-style utility classes instead of
ad-hoc rules. This eliminates a lot of single-purpose rules for specific
UI elements and standardizes margins to be more consistent throughout
the site.

Utility classes are defined manually on an as-needed basis instead of
importing Tailwind as a whole. Naming conventions mostly follow
Tailwind's conventions, otherwise they follow Bootstrap.

* https://tailwindcss.com/docs/
* https://getbootstrap.com/docs/5.0/utilities/spacing/
2021-02-16 09:28:38 -06:00

50 lines
1.9 KiB
Plaintext

<div id="c-saved-searches">
<div id="a-index">
<h1>
Saved Searches
<% if params[:label] %>
(<%= params[:label] %>)
<% end %>
</h1>
<%= search_form_for(saved_searches_path) do |f| %>
<%= f.input :query_ilike, label: "Query", hint: "Use * for wildcard", input_html: { value: params[:search][:query_ilike] } %>
<%= f.input :label, label: "Label", input_html: { value: params[:search][:label], "data-autocomplete": "saved-search-label" } %>
<%= f.input :order, collection: [%w[Newest id], %w[Query query], %w[Label label]], include_blank: false, selected: params[:search][:order] %>
<%= f.submit "Search" %>
<% end %>
<%= table_for @saved_searches, class: "striped autofit", width: "100%" do |t| %>
<% t.column "Query", th: {"data-sort": "string"}, td: {class: "col-expand"} do |ss| %>
<%= link_to ss.query, posts_path(tags: ss.query) %>
<% end %>
<% t.column "Labels", th: {"data-sort": "string"} do |ss| %>
<% ss.labels.each do |label| %>
<%= link_to label, posts_path(:tags => "search:#{label}") %>
<% end %>
<% end %>
<% t.column "Posts" do |ss| %>
<%= ss.cached_size if ss.cached_size > 0 %>
<% end %>
<% t.column "Refreshed" do |ss| %>
<% if ss.refreshed_at.present? %>
<%= time_ago_in_words_tagged ss.refreshed_at %>
<% else %>
&gt;<%= SavedSearch::REDIS_EXPIRY.inspect %> ago
<% end %>
<% end %>
<% t.column "Created" do |ss| %>
<%= time_ago_in_words_tagged ss.created_at %>
<% end %>
<% t.column column: "control" do |ss| %>
<%= link_to "edit", edit_saved_search_path(ss) %>
| <%= link_to "delete", saved_search_path(ss), :method => :delete, :remote => true %>
<% end %>
<% end %>
<%= numbered_paginator(@saved_searches) %>
</div>
</div>
<%= render "secondary_links" %>