style intro page, ignore artist tags in Tag.trending, set root page to explore/posts/intro
This commit is contained in:
@@ -16,4 +16,10 @@ div#c-explore-posts {
|
||||
padding: 1em;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
div#a-intro {
|
||||
width: 60em;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,12 @@ class Tag < ActiveRecord::Base
|
||||
counts = counts.to_a.select {|x| x[1] > trending_count_limit}
|
||||
counts = counts.map do |tag_name, recent_count|
|
||||
tag = Tag.find_or_create_by_name(tag_name)
|
||||
[tag_name, recent_count.to_f / tag.post_count.to_f]
|
||||
if tag.category == Danbooru.config.tag_category_mapping["artist"]
|
||||
# we're not interested in artists in the trending list
|
||||
[tag_name, 0]
|
||||
else
|
||||
[tag_name, recent_count.to_f / tag.post_count.to_f]
|
||||
end
|
||||
end
|
||||
|
||||
counts.sort_by {|x| -x[1]}.slice(0, 25).map(&:first)
|
||||
|
||||
@@ -352,5 +352,5 @@ Danbooru::Application.routes.draw do
|
||||
match "/static/benchmark" => "static#benchmark"
|
||||
match "/static/name_change" => "static#name_change", :as => "name_change"
|
||||
|
||||
root :to => "posts#index"
|
||||
root :to => "explore/posts#intro"
|
||||
end
|
||||
|
||||
27
test/functional/explore/posts_controller_test.rb
Normal file
27
test/functional/explore/posts_controller_test.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
require "test_helper"
|
||||
|
||||
module Explore
|
||||
class PostsControllerTest < ActionController::TestCase
|
||||
context "in all cases" do
|
||||
setup do
|
||||
CurrentUser.user = FactoryGirl.create(:user)
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
FactoryGirl.create(:post)
|
||||
end
|
||||
|
||||
context "#popular" do
|
||||
should "render" do
|
||||
get :popular
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "#intro" do
|
||||
should "render" do
|
||||
get :intro
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user