diff --git a/app/controllers/related_tags_controller.rb b/app/controllers/related_tags_controller.rb index e90a6d215..16cf5dea6 100644 --- a/app/controllers/related_tags_controller.rb +++ b/app/controllers/related_tags_controller.rb @@ -1,5 +1,6 @@ class RelatedTagsController < ApplicationController respond_to :json + respond_to :html, :only=>[:show] before_filter :require_reportbooru_key, only: [:update] def show diff --git a/app/logical/related_tag_query.rb b/app/logical/related_tag_query.rb index e2eb55007..8c387efc0 100644 --- a/app/logical/related_tag_query.rb +++ b/app/logical/related_tag_query.rb @@ -26,6 +26,10 @@ class RelatedTagQuery results end + def tags_for_html + map_with_category_data(tags) + end + def to_json {:query => query, :category => category, :tags => map_with_category_data(tags), :wiki_page_tags => map_with_category_data(wiki_page_tags)}.to_json end diff --git a/app/views/related_tags/show.html.erb b/app/views/related_tags/show.html.erb new file mode 100644 index 000000000..e5fcfe388 --- /dev/null +++ b/app/views/related_tags/show.html.erb @@ -0,0 +1,37 @@ +
+

Related tags

+
+ <%= form_tag(related_tag_path, :method => :get) do %> + <%= text_field_tag "query", params[:query] %> + <%= select_tag "category", options_for_select([""] + Danbooru.config.canonical_tag_category_mapping.map{|x| [x.first, x.first.downcase]}, params[:category]) %> + <%= submit_tag "Show"%> + <% end %> +
+ <% if params[:query].present? %> +
+ + + + + + + + <% @query.tags_for_html.each do |tag, category| %> + + + + <% end %> + +
Name
+ <%= link_to("?", show_or_new_wiki_pages_path(:title => tag)) %> + <%= link_to(tag, posts_path(:tags => tag)) %> +
+
+ <% end %> +
+ +<%= render "tags/secondary_links" %> + +<% content_for(:page_title) do %> + Related tags - <%= Danbooru.config.app_name %> +<% end %> \ No newline at end of file diff --git a/app/views/tags/_secondary_links.html.erb b/app/views/tags/_secondary_links.html.erb index 854f4eff6..9db33e1cc 100644 --- a/app/views/tags/_secondary_links.html.erb +++ b/app/views/tags/_secondary_links.html.erb @@ -3,6 +3,7 @@
  • <%= render "tags/quick_search" %>
  • <%= link_to "Listing", tags_path %>
  • <%= link_to "MetaSearch", meta_searches_tags_path %>
  • +
  • <%= link_to "Related tags", related_tag_path %>
  • <%= link_to "Cheatsheet", wiki_pages_path(:search => {:title => "help:cheatsheet"}) %>
  • <%= link_to "Help", wiki_pages_path(:search => {:title => "help:tags"}) %>
  • <% if @tag %>