This commit is contained in:
Toks
2013-07-23 22:50:42 -04:00
6 changed files with 20 additions and 7 deletions

View File

@@ -124,10 +124,10 @@ class Tag < ActiveRecord::Base
def trending def trending
Cache.get("popular-tags-v3", 1.hour) do Cache.get("popular-tags-v3", 1.hour) do
CurrentUser.scoped(User.admins.first, "127.0.0.1") do CurrentUser.scoped(User.admins.first, "127.0.0.1") do
n = 8 n = 24
counts = {} counts = {}
while counts.empty? && n < 256 while counts.empty? && n < 1000
tag_strings = Post.select_values_sql("select tag_string from posts where created_at >= ?", n.hours.ago) tag_strings = Post.select_values_sql("select tag_string from posts where created_at >= ?", n.hours.ago)
tag_strings.each do |tag_string| tag_strings.each do |tag_string|
tag_string.scan(/\S+/).each do |tag| tag_string.scan(/\S+/).each do |tag|

View File

@@ -1,4 +1,6 @@
class PostPresenter < Presenter class PostPresenter < Presenter
attr_reader :pool, :next_post_in_pool
def self.preview(post, options = {}) def self.preview(post, options = {})
if post.is_deleted? && options[:tags] !~ /status:(?:all|any|deleted|banned)/ && !options[:raw] if post.is_deleted? && options[:tags] !~ /status:(?:all|any|deleted|banned)/ && !options[:raw]
return "" return ""
@@ -231,6 +233,7 @@ class PostPresenter < Presenter
pool_html << '</span> ' pool_html << '</span> '
if pool.neighbors(@post).next if pool.neighbors(@post).next
@next_post_in_pool = pool.neighbors(@post).next
pool_html << template.link_to("next&thinsp;&rsaquo;".html_safe, template.post_path(pool.neighbors(@post).next, :pool_id => pool.id), :rel => next_rel, :class => "#{klass} next", :title => "to page #{pool.page_number(pool.neighbors(@post).next)}") pool_html << template.link_to("next&thinsp;&rsaquo;".html_safe, template.post_path(pool.neighbors(@post).next, :pool_id => pool.id), :rel => next_rel, :class => "#{klass} next", :title => "to page #{pool.page_number(pool.neighbors(@post).next)}")
match_found = true match_found = true
else else

View File

@@ -2,6 +2,11 @@
<div id="a-index"> <div id="a-index">
<h1>Forum</h1> <h1>Forum</h1>
<p>
Categories:
<%= link_to "All", forum_topics_path %>, <%= ForumTopic::CATEGORIES.map {|id, name| link_to_unless_current(name, forum_topics_path(:search => {:category_id => id}))}.join(", ").html_safe %>
</p>
<table width="100%" class="striped"> <table width="100%" class="striped">
<thead> <thead>
<tr> <tr>
@@ -13,7 +18,7 @@
</thead> </thead>
<tbody> <tbody>
<% @forum_topics.each do |topic| %> <% @forum_topics.each do |topic| %>
<tr class="forum-topic-row"> <tr class="forum-topic-row forum-topic-category-<%= topic.category_id %>">
<td> <td>
<% if topic.is_sticky? %> <% if topic.is_sticky? %>
<span class="sticky">Sticky:</span> <span class="sticky">Sticky:</span>

View File

@@ -116,6 +116,11 @@
<meta name="twitter:image:width" content="<%= @post.image_width %>"> <meta name="twitter:image:width" content="<%= @post.image_width %>">
<meta name="twitter:image:height" content="<%= @post.image_height %>"> <meta name="twitter:image:height" content="<%= @post.image_height %>">
<% end %> <% end %>
<% if @post.presenter.next_post_in_pool %>
<link rel="prefetch" href="<%= post_path(@post.presenter.next_post_in_pool, :pool_id => params[:pool_id]) %>">
<link rel="prerender" href="<%= post_path(@post.presenter.next_post_in_pool, :pool_id => params[:pool_id]) %>">
<% end %>
<% end %> <% end %>
<%= render "posts/partials/common/secondary_links" %> <%= render "posts/partials/common/secondary_links" %>

View File

@@ -15,8 +15,8 @@
<th>Posts</th> <th>Posts</th>
<th>Deleted</th> <th>Deleted</th>
<% if CurrentUser.user.is_janitor? %> <% if CurrentUser.user.is_janitor? %>
<th><abbr title="1+ Favorite(s) Binomial Confidence Interval">1+ FBCI</abbr></th> <th><abbr title="5+ Score Binomial Confidence Interval">5+ SBCI</abbr></th>
<th><abbr title="5+ Favorites Binomial Confidence Interval">5+ FBCI</abbr></th> <th><abbr title="10+ Score Binomial Confidence Interval">10+ SBCI</abbr></th>
<% end %> <% end %>
<th>Notes</th> <th>Notes</th>
<th>Edits</th> <th>Edits</th>
@@ -41,8 +41,8 @@
<td><%= link_to user.posts.count, posts_path(:tags => "user:#{user.name}") %></td> <td><%= link_to user.posts.count, posts_path(:tags => "user:#{user.name}") %></td>
<td><%= user.posts.deleted.count %></td> <td><%= user.posts.deleted.count %></td>
<% if CurrentUser.user.is_janitor? %> <% if CurrentUser.user.is_janitor? %>
<td><%= number_to_percentage Reports::UserPromotions.confidence_interval_for(user, 1), :precision => 0 %></td>
<td><%= number_to_percentage Reports::UserPromotions.confidence_interval_for(user, 5), :precision => 0 %></td> <td><%= number_to_percentage Reports::UserPromotions.confidence_interval_for(user, 5), :precision => 0 %></td>
<td><%= number_to_percentage Reports::UserPromotions.confidence_interval_for(user, 10), :precision => 0 %></td>
<% end %> <% end %>
<td><%= link_to user.note_versions.count, note_versions_path(:search => {:updater_id => user.id}) %></td> <td><%= link_to user.note_versions.count, note_versions_path(:search => {:updater_id => user.id}) %></td>
<td><%= link_to user.post_update_count, post_versions_path(:search => {:updater_id => user.id}) %></td> <td><%= link_to user.post_update_count, post_versions_path(:search => {:updater_id => user.id}) %></td>

View File

@@ -4,7 +4,7 @@ module Danbooru
class Configuration class Configuration
# The version of this Danbooru. # The version of this Danbooru.
def version def version
"2.25.0" "2.26.0"
end end
# The name of this Danbooru. # The name of this Danbooru.