Remove /meta_searches/tags page.
This was a search page that let you search for tags, aliases, and implications at the same time. It never got much use and it's been broken for a while now (the search form passed the wrong param to the controller).
This commit is contained in:
@@ -1,6 +0,0 @@
|
|||||||
class MetaSearchesController < ApplicationController
|
|
||||||
def tags
|
|
||||||
@meta_search = MetaSearches::Tag.new(params)
|
|
||||||
@meta_search.load_all
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -304,7 +304,7 @@ module ApplicationHelper
|
|||||||
when "artists", "artist_versions"
|
when "artists", "artist_versions"
|
||||||
/^\/artist/
|
/^\/artist/
|
||||||
|
|
||||||
when "tags", "meta_searches"
|
when "tags"
|
||||||
/^\/tags/
|
/^\/tags/
|
||||||
|
|
||||||
when "pools", "pool_versions"
|
when "pools", "pool_versions"
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
class MetaSearches::Tag
|
|
||||||
MAX_RESULTS = 25
|
|
||||||
attr_reader :search_params, :tags, :tag_aliases, :tag_implications
|
|
||||||
|
|
||||||
def initialize(search_params)
|
|
||||||
@search_params = search_params
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_all
|
|
||||||
load_tags
|
|
||||||
load_tag_aliases
|
|
||||||
load_tag_implications
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_tags
|
|
||||||
@tags = ::Tag.name_matches(name_param).limit(MAX_RESULTS)
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_tag_aliases
|
|
||||||
@tag_aliases = TagAlias.name_matches(name_param).limit(MAX_RESULTS)
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_tag_implications
|
|
||||||
@tag_implications = TagImplication.name_matches(name_param).limit(MAX_RESULTS)
|
|
||||||
end
|
|
||||||
|
|
||||||
def name_param
|
|
||||||
search_params[:name] || ""
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
<div id="c-meta-searches">
|
|
||||||
<div id="a-tags">
|
|
||||||
<h1>MetaSearch Tags</h1>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<%= search_form_for(meta_searches_tags_path) do |f| %>
|
|
||||||
<%= f.input :name, input_html: { value: params.dig(:search, :name), "data-autocomplete": "tag" } %>
|
|
||||||
<%= f.submit "Search" %>
|
|
||||||
<% end %>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h2>Tags</h2>
|
|
||||||
|
|
||||||
<% if @meta_search.tags.empty? %>
|
|
||||||
<p>No results</p>
|
|
||||||
<% else %>
|
|
||||||
<table width="100%" class="striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Count</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @meta_search.tags.each do |tag| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= tag.name %></td>
|
|
||||||
<td><%= tag.post_count %></td>
|
|
||||||
<td>
|
|
||||||
<% if tag.editable_by?(CurrentUser.user) %>
|
|
||||||
<%= link_to "edit", edit_tag_path(tag) %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% end %>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h2>Tag Aliases</h2>
|
|
||||||
<% if @meta_search.tag_aliases.empty? %>
|
|
||||||
<p>No results</p>
|
|
||||||
<% else %>
|
|
||||||
<table width="100%" class="striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>From</th>
|
|
||||||
<th>To</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @meta_search.tag_aliases.each do |tag_alias| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= tag_alias.antecedent_name %></td>
|
|
||||||
<td><%= tag_alias.consequent_name %></td>
|
|
||||||
<td>
|
|
||||||
<%= link_to "Show", tag_alias_path(tag_alias) %>
|
|
||||||
<% if tag_alias.deletable_by?(CurrentUser.user) %>
|
|
||||||
| <%= link_to "Delete", tag_alias_path(tag_alias), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this alias?"} %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if CurrentUser.is_admin? && tag_alias.is_pending? %>
|
|
||||||
| <%= link_to "Approve", approve_tag_alias_path(tag_alias), :remote => true, :method => :post %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% end %>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h2>Tag Implications</h2>
|
|
||||||
<% if @meta_search.tag_implications.empty? %>
|
|
||||||
<p>No results</p>
|
|
||||||
<% else %>
|
|
||||||
<table width="100%" class="striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>From</th>
|
|
||||||
<th>To</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @meta_search.tag_implications.each do |tag_implication| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= tag_implication.antecedent_name %></td>
|
|
||||||
<td><%= tag_implication.consequent_name %></td>
|
|
||||||
<td>
|
|
||||||
<%= link_to "Show", tag_implication_path(tag_implication) %>
|
|
||||||
<% if tag_implication.deletable_by?(CurrentUser.user) %>
|
|
||||||
| <%= link_to "Delete", tag_implication_path(tag_implication), :remote => true, :method => :delete, :data => {:confirm => "Are you sure you want to delete this implication?"} %>
|
|
||||||
<% end %>
|
|
||||||
<% if CurrentUser.user.is_admin? && tag_implication.is_pending? %>
|
|
||||||
| <%= link_to "Approve", approve_tag_implication_path(tag_implication), :remote => true, :method => :post %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% end %>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= render "tags/secondary_links" %>
|
|
||||||
|
|
||||||
<% content_for(:page_title) do %>
|
|
||||||
MetaSearch - Tags - <%= Danbooru.config.app_name %>
|
|
||||||
<% end %>
|
|
||||||
@@ -54,7 +54,6 @@
|
|||||||
<li><%= link_to("Aliases", tag_aliases_path) %></li>
|
<li><%= link_to("Aliases", tag_aliases_path) %></li>
|
||||||
<li><%= link_to("Implications", tag_implications_path) %></li>
|
<li><%= link_to("Implications", tag_implications_path) %></li>
|
||||||
<li><%= link_to("Listing", tags_path) %></li>
|
<li><%= link_to("Listing", tags_path) %></li>
|
||||||
<li><%= link_to("Search", meta_searches_tags_path) %></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
<li><h1>Notes</h1></li>
|
<li><h1>Notes</h1></li>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<% content_for(:secondary_links) do %>
|
<% content_for(:secondary_links) do %>
|
||||||
<%= subnav_link_to "Listing", tag_aliases_path %>
|
<%= subnav_link_to "Listing", tag_aliases_path %>
|
||||||
<%= subnav_link_to "MetaSearch", meta_searches_tags_path %>
|
|
||||||
<%= subnav_link_to "Request alias", new_bulk_update_request_path %>
|
<%= subnav_link_to "Request alias", new_bulk_update_request_path %>
|
||||||
<%= subnav_link_to "Help", wiki_page_path("help:tag_aliases") %>
|
<%= subnav_link_to "Help", wiki_page_path("help:tag_aliases") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<% content_for(:secondary_links) do %>
|
<% content_for(:secondary_links) do %>
|
||||||
<%= subnav_link_to "Listing", tag_implications_path %>
|
<%= subnav_link_to "Listing", tag_implications_path %>
|
||||||
<%= subnav_link_to "MetaSearch", meta_searches_tags_path %>
|
|
||||||
<%= subnav_link_to "Request implication", new_bulk_update_request_path %>
|
<%= subnav_link_to "Request implication", new_bulk_update_request_path %>
|
||||||
<%= subnav_link_to "Help", wiki_page_path("help:tag_implications") %>
|
<%= subnav_link_to "Help", wiki_page_path("help:tag_implications") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<% content_for(:secondary_links) do %>
|
<% content_for(:secondary_links) do %>
|
||||||
<%= quick_search_form_for(:name_matches, tags_path, "tags", autocomplete: "tag") %>
|
<%= quick_search_form_for(:name_matches, tags_path, "tags", autocomplete: "tag") %>
|
||||||
<%= subnav_link_to "Listing", tags_path %>
|
<%= subnav_link_to "Listing", tags_path %>
|
||||||
<%= subnav_link_to "MetaSearch", meta_searches_tags_path %>
|
|
||||||
<%= subnav_link_to "Related tags", related_tag_path %>
|
<%= subnav_link_to "Related tags", related_tag_path %>
|
||||||
<%= subnav_link_to "Cheatsheet", wiki_page_path("help:cheatsheet") %>
|
<%= subnav_link_to "Cheatsheet", wiki_page_path("help:cheatsheet") %>
|
||||||
<%= subnav_link_to "Help", wiki_page_path("help:tags") %>
|
<%= subnav_link_to "Help", wiki_page_path("help:tags") %>
|
||||||
|
|||||||
@@ -402,7 +402,6 @@ Rails.application.routes.draw do
|
|||||||
get "/static/terms_of_service" => "static#terms_of_service", :as => "terms_of_service"
|
get "/static/terms_of_service" => "static#terms_of_service", :as => "terms_of_service"
|
||||||
get "/static/contact" => "static#contact", :as => "contact"
|
get "/static/contact" => "static#contact", :as => "contact"
|
||||||
get "/static/dtext_help" => "static#dtext_help", :as => "dtext_help"
|
get "/static/dtext_help" => "static#dtext_help", :as => "dtext_help"
|
||||||
get "/meta_searches/tags" => "meta_searches#tags", :as => "meta_searches_tags"
|
|
||||||
|
|
||||||
get "/intro" => redirect("/explore/posts/intro")
|
get "/intro" => redirect("/explore/posts/intro")
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
require 'test_helper'
|
|
||||||
|
|
||||||
class MetaSearchesControllerTest < ActionDispatch::IntegrationTest
|
|
||||||
context "The meta searches controller" do
|
|
||||||
context "tags action" do
|
|
||||||
should "work" do
|
|
||||||
get meta_searches_tags_path, params: {name: "long_hair"}
|
|
||||||
assert_response :success
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
require "test_helper"
|
|
||||||
|
|
||||||
module MetaSearches
|
|
||||||
class TagTest < ActionMailer::TestCase
|
|
||||||
context "The tag metasearch" do
|
|
||||||
setup do
|
|
||||||
CurrentUser.user = FactoryBot.create(:user)
|
|
||||||
CurrentUser.ip_addr = "127.0.0.1"
|
|
||||||
FactoryBot.create(:post, :tag_string => "xxx")
|
|
||||||
FactoryBot.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb")
|
|
||||||
FactoryBot.create(:tag_implication, :antecedent_name => "ccc", :consequent_name => "ddd")
|
|
||||||
end
|
|
||||||
|
|
||||||
should "find the tag" do
|
|
||||||
meta_search = MetaSearches::Tag.new(:name => "xxx")
|
|
||||||
meta_search.load_all
|
|
||||||
assert_equal(1, meta_search.tags.size)
|
|
||||||
assert_equal("xxx", meta_search.tags.first.name)
|
|
||||||
end
|
|
||||||
|
|
||||||
should "find the alias" do
|
|
||||||
meta_search = MetaSearches::Tag.new(:name => "aaa")
|
|
||||||
meta_search.load_all
|
|
||||||
assert_equal(1, meta_search.tag_aliases.size)
|
|
||||||
assert_equal("aaa", meta_search.tag_aliases.first.antecedent_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
should "find the implication" do
|
|
||||||
meta_search = MetaSearches::Tag.new(:name => "ccc")
|
|
||||||
meta_search.load_all
|
|
||||||
assert_equal(1, meta_search.tag_implications.size)
|
|
||||||
assert_equal("ccc", meta_search.tag_implications.first.antecedent_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user