From b3eeb170cba672b5088d7f6543f1d30c73bcfd3b Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 12 Jan 2020 20:17:43 -0600 Subject: [PATCH] explore/posts/intro: remove page. This was an alternate frontpage that contained a list of previews of the most popular tags. This page was never linked from anywhere and it was unknown by most users. --- app/controllers/explore/posts_controller.rb | 5 --- .../src/styles/specific/explore.scss | 6 --- app/logical/post_sets/intro.rb | 15 ------- app/presenters/intro_presenter.rb | 7 ---- app/views/explore/posts/intro.html.erb | 30 -------------- config/routes.rb | 3 -- .../explore/posts_controller_test.rb | 7 ---- test/unit/post_sets/intro_test.rb | 40 ------------------- 8 files changed, 113 deletions(-) delete mode 100644 app/logical/post_sets/intro.rb delete mode 100644 app/presenters/intro_presenter.rb delete mode 100644 app/views/explore/posts/intro.html.erb delete mode 100644 test/unit/post_sets/intro_test.rb diff --git a/app/controllers/explore/posts_controller.rb b/app/controllers/explore/posts_controller.rb index 17e9e092e..f94004914 100644 --- a/app/controllers/explore/posts_controller.rb +++ b/app/controllers/explore/posts_controller.rb @@ -26,11 +26,6 @@ module Explore @search_service = MissedSearchService.new end - def intro - @presenter = IntroPresenter.new - render :layout => "blank" - end - private def set_date diff --git a/app/javascript/src/styles/specific/explore.scss b/app/javascript/src/styles/specific/explore.scss index 3a99a0990..62b76e2d6 100644 --- a/app/javascript/src/styles/specific/explore.scss +++ b/app/javascript/src/styles/specific/explore.scss @@ -16,10 +16,4 @@ div#c-explore-posts { padding: 1em; margin-bottom: 2em; } - - div#a-intro { - width: 870px; - margin: 0 auto; - text-align: center; - } } diff --git a/app/logical/post_sets/intro.rb b/app/logical/post_sets/intro.rb deleted file mode 100644 index 4c73d3798..000000000 --- a/app/logical/post_sets/intro.rb +++ /dev/null @@ -1,15 +0,0 @@ -module PostSets - class Intro < PostSets::Post - def initialize(tags) - super(tags) - end - - def posts - @posts ||= begin - temp = ::Post.tag_match("#{tag_string} favcount:>3").paginate(page, :search_count => nil, :limit => 5) - temp.each # hack to force rails to eager load - temp - end - end - end -end diff --git a/app/presenters/intro_presenter.rb b/app/presenters/intro_presenter.rb deleted file mode 100644 index f6fd66b7b..000000000 --- a/app/presenters/intro_presenter.rb +++ /dev/null @@ -1,7 +0,0 @@ -class IntroPresenter - def each - PopularSearchService.new(Date.today).each_search(20) do |query, count| - yield(query, PostSets::Intro.new(query)) - end - end -end diff --git a/app/views/explore/posts/intro.html.erb b/app/views/explore/posts/intro.html.erb deleted file mode 100644 index 2f33b86da..000000000 --- a/app/views/explore/posts/intro.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -
-
-
-

<%= link_to Danbooru.config.app_name, posts_path %>

- - - <%= form_tag(posts_path, :method => :get) do %> - <%= text_field_tag "tags", "", :size => 50, :data => { :autocomplete => "tag-query" } %> - <%= submit_tag "Search" %> - <% end %> -
- -

Type in your favorite anime, manga, or character (last name first). Here are some popular examples:

- - <% cache("intro-page", :expires_in => 1.hour) do %> - <% @presenter.each do |tag, post_set| %> -
-

<%= link_to tag, posts_path(:tags => tag) %>

- <%= post_set.presenter.post_previews_html(self, show_cropped: true) %> -
- <% end %> - <% end %> -
-
- -<%= render "static/footer" %> - -<% content_for(:page_title) do %> - <%= Danbooru.config.app_name %> -<% end %> diff --git a/config/routes.rb b/config/routes.rb index c1d6a5f2f..967f3dfa3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -49,7 +49,6 @@ Rails.application.routes.draw do get :viewed get :searches get :missed_searches - get :intro end end end @@ -400,8 +399,6 @@ Rails.application.routes.draw do get "/static/contact" => "static#contact", :as => "contact" get "/static/dtext_help" => "static#dtext_help", :as => "dtext_help" - get "/intro" => redirect("/explore/posts/intro") - root :to => "posts#index" get "*other", :to => "static#not_found" diff --git a/test/functional/explore/posts_controller_test.rb b/test/functional/explore/posts_controller_test.rb index 2f8a9a861..8d693eaab 100644 --- a/test/functional/explore/posts_controller_test.rb +++ b/test/functional/explore/posts_controller_test.rb @@ -30,13 +30,6 @@ module Explore assert_response :success end end - - context "#intro" do - should "render" do - get intro_explore_posts_path - assert_response :success - end - end end end end diff --git a/test/unit/post_sets/intro_test.rb b/test/unit/post_sets/intro_test.rb deleted file mode 100644 index 075dccde2..000000000 --- a/test/unit/post_sets/intro_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'test_helper' - -module PostSets - class IntroTest < ActiveSupport::TestCase - context "In all cases" do - setup do - @user = FactoryBot.create(:user) - CurrentUser.user = @user - CurrentUser.ip_addr = "127.0.0.1" - - @post_1 = FactoryBot.create(:post, :tag_string => "a") - @post_2 = FactoryBot.create(:post, :tag_string => "b") - @post_3 = FactoryBot.create(:post, :tag_string => "c") - end - - teardown do - CurrentUser.user = nil - CurrentUser.ip_addr = nil - end - - context "a set for the 'a' tag query" do - setup do - @post_4 = FactoryBot.create(:post, :tag_string => "a", :fav_count => 5) - @post_5 = FactoryBot.create(:post, :tag_string => "a", :fav_count => 5) - end - - context "with no page" do - setup do - @set = PostSets::Intro.new("a") - ::Post.stubs(:records_per_page).returns(1) - end - - should "return the first element" do - assert_equal(@post_5.id, @set.posts.first.id) - end - end - end - end - end -end