From 1ab6a353caa360a3491f398f93c4a1c0b5453cfc Mon Sep 17 00:00:00 2001 From: evazion Date: Tue, 7 Jan 2020 11:10:56 -0600 Subject: [PATCH] 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). --- app/controllers/meta_searches_controller.rb | 6 - app/helpers/application_helper.rb | 2 +- app/logical/meta_searches/tag.rb | 30 ----- app/views/meta_searches/tags.html.erb | 122 ------------------ app/views/static/site_map.html.erb | 1 - .../tag_aliases/_secondary_links.html.erb | 1 - .../_secondary_links.html.erb | 1 - app/views/tags/_secondary_links.html.erb | 1 - config/routes.rb | 1 - .../meta_searches_controller_test.rb | 12 -- test/unit/meta_searches/tag_test.rb | 36 ------ 11 files changed, 1 insertion(+), 212 deletions(-) delete mode 100644 app/controllers/meta_searches_controller.rb delete mode 100644 app/logical/meta_searches/tag.rb delete mode 100644 app/views/meta_searches/tags.html.erb delete mode 100644 test/functional/meta_searches_controller_test.rb delete mode 100644 test/unit/meta_searches/tag_test.rb diff --git a/app/controllers/meta_searches_controller.rb b/app/controllers/meta_searches_controller.rb deleted file mode 100644 index c9fd25126..000000000 --- a/app/controllers/meta_searches_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class MetaSearchesController < ApplicationController - def tags - @meta_search = MetaSearches::Tag.new(params) - @meta_search.load_all - end -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 23fd35ab7..74127c8b5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -304,7 +304,7 @@ module ApplicationHelper when "artists", "artist_versions" /^\/artist/ - when "tags", "meta_searches" + when "tags" /^\/tags/ when "pools", "pool_versions" diff --git a/app/logical/meta_searches/tag.rb b/app/logical/meta_searches/tag.rb deleted file mode 100644 index 46eec97d3..000000000 --- a/app/logical/meta_searches/tag.rb +++ /dev/null @@ -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 diff --git a/app/views/meta_searches/tags.html.erb b/app/views/meta_searches/tags.html.erb deleted file mode 100644 index 220124a71..000000000 --- a/app/views/meta_searches/tags.html.erb +++ /dev/null @@ -1,122 +0,0 @@ -
-
-

MetaSearch Tags

- -
- <%= 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 %> -
- -
-

Tags

- - <% if @meta_search.tags.empty? %> -

No results

- <% else %> - - - - - - - - - - - <% @meta_search.tags.each do |tag| %> - - - - - - <% end %> - -
NameCount
<%= tag.name %><%= tag.post_count %> - <% if tag.editable_by?(CurrentUser.user) %> - <%= link_to "edit", edit_tag_path(tag) %> - <% end %> -
- <% end %> -
- - -
-

Tag Aliases

- <% if @meta_search.tag_aliases.empty? %> -

No results

- <% else %> - - - - - - - - - - - <% @meta_search.tag_aliases.each do |tag_alias| %> - - - - - - <% end %> - -
FromTo
<%= tag_alias.antecedent_name %><%= tag_alias.consequent_name %> - <%= 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 %> -
- <% end %> -
- -
-

Tag Implications

- <% if @meta_search.tag_implications.empty? %> -

No results

- <% else %> - - - - - - - - - - - <% @meta_search.tag_implications.each do |tag_implication| %> - - - - - - <% end %> - -
FromTo
<%= tag_implication.antecedent_name %><%= tag_implication.consequent_name %> - <%= 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 %> -
- <% end %> -
-
-
- -<%= render "tags/secondary_links" %> - -<% content_for(:page_title) do %> - MetaSearch - Tags - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/static/site_map.html.erb b/app/views/static/site_map.html.erb index 06f6d618e..f23a14566 100644 --- a/app/views/static/site_map.html.erb +++ b/app/views/static/site_map.html.erb @@ -54,7 +54,6 @@
  • <%= link_to("Aliases", tag_aliases_path) %>
  • <%= link_to("Implications", tag_implications_path) %>
  • <%= link_to("Listing", tags_path) %>
  • -
  • <%= link_to("Search", meta_searches_tags_path) %>