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.
This commit is contained in:
evazion
2020-01-12 20:17:43 -06:00
parent 12a845de92
commit b3eeb170cb
8 changed files with 0 additions and 113 deletions

View File

@@ -26,11 +26,6 @@ module Explore
@search_service = MissedSearchService.new
end
def intro
@presenter = IntroPresenter.new
render :layout => "blank"
end
private
def set_date

View File

@@ -16,10 +16,4 @@ div#c-explore-posts {
padding: 1em;
margin-bottom: 2em;
}
div#a-intro {
width: 870px;
margin: 0 auto;
text-align: center;
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -1,30 +0,0 @@
<div id="c-explore-posts">
<div id="a-intro">
<header>
<h1><%= link_to Danbooru.config.app_name, posts_path %></h1>
<p class="byline">Find good anime art fast</p>
<%= form_tag(posts_path, :method => :get) do %>
<%= text_field_tag "tags", "", :size => 50, :data => { :autocomplete => "tag-query" } %>
<%= submit_tag "Search" %>
<% end %>
</header>
<p style="text-align: center;">Type in your favorite anime, manga, or character (last name first). Here are some popular examples:</p>
<% cache("intro-page", :expires_in => 1.hour) do %>
<% @presenter.each do |tag, post_set| %>
<div class="posts">
<h2><%= link_to tag, posts_path(:tags => tag) %></h2>
<%= post_set.presenter.post_previews_html(self, show_cropped: true) %>
</div>
<% end %>
<% end %>
</div>
</div>
<%= render "static/footer" %>
<% content_for(:page_title) do %>
<%= Danbooru.config.app_name %>
<% end %>

View File

@@ -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"

View File

@@ -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

View File

@@ -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