added popular exploration, added order:rank
This commit is contained in:
@@ -334,6 +334,7 @@ div#page {
|
|||||||
width: 75%;
|
width: 75%;
|
||||||
float: left;
|
float: left;
|
||||||
margin-left: 2em;
|
margin-left: 2em;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -714,6 +715,9 @@ div#c-posts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div#c-explore-posts {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*** Post Histories ***/
|
/*** Post Histories ***/
|
||||||
div.post_histories {
|
div.post_histories {
|
||||||
|
|||||||
11
app/controllers/explore/posts_controller.rb
Normal file
11
app/controllers/explore/posts_controller.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
module Explore
|
||||||
|
class PostsController < ApplicationController
|
||||||
|
respond_to :html, :xml, :json
|
||||||
|
|
||||||
|
def popular
|
||||||
|
@post_set = PostSets::Popular.new(params[:date], params[:scale])
|
||||||
|
@posts = @post_set.posts
|
||||||
|
respond_with(@posts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -4,7 +4,7 @@ class PixivProxy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.get(url)
|
def self.get(url)
|
||||||
if url =~ /\/(\d+)(_m)?\.(jpg|jpeg|png|gif)/i
|
if url =~ /\/(\d+)(_m|_p\d+)?\.(jpg|jpeg|png|gif)/i
|
||||||
url = "http://www.pixiv.net/member_illust.php?mode=medium&illust_id=#{$1}"
|
url = "http://www.pixiv.net/member_illust.php?mode=medium&illust_id=#{$1}"
|
||||||
get_single(url)
|
get_single(url)
|
||||||
elsif url =~ /member_illust\.php/ && url =~ /illust_id=/
|
elsif url =~ /member_illust\.php/ && url =~ /illust_id=/
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module PostSets
|
|||||||
attr_reader :artist
|
attr_reader :artist
|
||||||
|
|
||||||
def initialize(artist)
|
def initialize(artist)
|
||||||
super(:tags => artist.name)
|
super(artist.name)
|
||||||
@artist = artist
|
@artist = artist
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ module PostSets
|
|||||||
end
|
end
|
||||||
|
|
||||||
def artist
|
def artist
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_single_tag?
|
def is_single_tag?
|
||||||
|
|||||||
48
app/logical/post_sets/popular.rb
Normal file
48
app/logical/post_sets/popular.rb
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
module PostSets
|
||||||
|
class Popular < Base
|
||||||
|
attr_reader :date, :scale
|
||||||
|
|
||||||
|
def initialize(date, scale)
|
||||||
|
@date = date.blank? ? Date.today : date.to_date
|
||||||
|
@scale = scale
|
||||||
|
end
|
||||||
|
|
||||||
|
def posts
|
||||||
|
::Post.where("created_at between ? and ?", min_date, max_date + 1).order("score desc").limit(limit)
|
||||||
|
end
|
||||||
|
|
||||||
|
def limit
|
||||||
|
25
|
||||||
|
end
|
||||||
|
|
||||||
|
def min_date
|
||||||
|
case scale
|
||||||
|
when "week"
|
||||||
|
date.beginning_of_week
|
||||||
|
|
||||||
|
when "month"
|
||||||
|
date.beginning_of_month
|
||||||
|
|
||||||
|
else
|
||||||
|
date
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def max_date
|
||||||
|
case scale
|
||||||
|
when "week"
|
||||||
|
date.end_of_week
|
||||||
|
|
||||||
|
when "month"
|
||||||
|
date.end_of_month
|
||||||
|
|
||||||
|
else
|
||||||
|
date
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def presenter
|
||||||
|
::PostSetPresenters::Popular.new(self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -13,6 +13,7 @@ class Comment < ActiveRecord::Base
|
|||||||
scope :body_matches, lambda {|query| where("body_index @@ plainto_tsquery(?)", query).order("comments.id DESC")}
|
scope :body_matches, lambda {|query| where("body_index @@ plainto_tsquery(?)", query).order("comments.id DESC")}
|
||||||
scope :hidden, lambda {|user| where("score < ?", user.comment_threshold)}
|
scope :hidden, lambda {|user| where("score < ?", user.comment_threshold)}
|
||||||
scope :post_tag_match, lambda {|query| joins(:post).where("posts.tag_index @@ to_tsquery('danbooru', ?)", query)}
|
scope :post_tag_match, lambda {|query| joins(:post).where("posts.tag_index @@ to_tsquery('danbooru', ?)", query)}
|
||||||
|
scope :for_user, lambda {|user_id| where("creator_id = ?", user_id)}
|
||||||
|
|
||||||
search_methods :body_matches, :post_tag_match
|
search_methods :body_matches, :post_tag_match
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Favorite < ActiveRecord::Base
|
class Favorite < ActiveRecord::Base
|
||||||
belongs_to :post
|
belongs_to :post
|
||||||
scope :for_user, lambda {|user_id| where("user_id = ?", user_id)}
|
scope :for_user, lambda {|user_id| where("user_id = #{user_id}")}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class ForumPost < ActiveRecord::Base
|
|||||||
validates_presence_of :body, :creator_id
|
validates_presence_of :body, :creator_id
|
||||||
validate :validate_topic_is_unlocked
|
validate :validate_topic_is_unlocked
|
||||||
scope :body_matches, lambda {|body| where(["text_index @@ plainto_tsquery(?)", body])}
|
scope :body_matches, lambda {|body| where(["text_index @@ plainto_tsquery(?)", body])}
|
||||||
|
scope :for_user, lambda {|user_id| where("creator_id = ?", user_id)}
|
||||||
search_methods :body_matches
|
search_methods :body_matches
|
||||||
|
|
||||||
def self.new_reply(params)
|
def self.new_reply(params)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class NoteVersion < ActiveRecord::Base
|
class NoteVersion < ActiveRecord::Base
|
||||||
before_validation :initialize_updater
|
before_validation :initialize_updater
|
||||||
belongs_to :updater, :class_name => "User"
|
belongs_to :updater, :class_name => "User"
|
||||||
|
scope :for_user, lambda {|user_id| where("updater_id = ?", user_id)}
|
||||||
|
|
||||||
def initialize_updater
|
def initialize_updater
|
||||||
self.updater_id = CurrentUser.id
|
self.updater_id = CurrentUser.id
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class PoolVersion < ActiveRecord::Base
|
|||||||
belongs_to :pool
|
belongs_to :pool
|
||||||
belongs_to :updater, :class_name => "User"
|
belongs_to :updater, :class_name => "User"
|
||||||
before_validation :initialize_updater
|
before_validation :initialize_updater
|
||||||
|
scope :for_user, lambda {|user_id| where("updater_id = ?", user_id)}
|
||||||
|
|
||||||
def initialize_updater
|
def initialize_updater
|
||||||
self.updater_id = CurrentUser.id
|
self.updater_id = CurrentUser.id
|
||||||
|
|||||||
@@ -586,6 +586,10 @@ class Post < ActiveRecord::Base
|
|||||||
relation = relation.where("posts.rating <> 'e'")
|
relation = relation.where("posts.rating <> 'e'")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if q[:order] == "rank"
|
||||||
|
relation = relation.where("p.score > 0 and p.created_at >= ?", 0, 3.days.ago)
|
||||||
|
end
|
||||||
|
|
||||||
case q[:order]
|
case q[:order]
|
||||||
when "id", "id_asc"
|
when "id", "id_asc"
|
||||||
relation = relation.order("posts.id")
|
relation = relation.order("posts.id")
|
||||||
@@ -619,6 +623,9 @@ class Post < ActiveRecord::Base
|
|||||||
when "filesize_asc"
|
when "filesize_asc"
|
||||||
relation = relation.order("posts.file_size")
|
relation = relation.order("posts.file_size")
|
||||||
|
|
||||||
|
when "rank"
|
||||||
|
sql << " ORDER BY log(3, p.score) + (extract(epoch from p.created_at) - extract(epoch from timestamp '2005-05-24')) / 45000 DESC"
|
||||||
|
|
||||||
else
|
else
|
||||||
relation = relation.order("posts.id DESC")
|
relation = relation.order("posts.id DESC")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class PostVersion < ActiveRecord::Base
|
|||||||
belongs_to :post
|
belongs_to :post
|
||||||
belongs_to :updater, :class_name => "User"
|
belongs_to :updater, :class_name => "User"
|
||||||
before_validation :initialize_updater
|
before_validation :initialize_updater
|
||||||
|
scope :for_user, lambda {|user_id| where("updater_id = ?", user_id)}
|
||||||
|
|
||||||
def self.create_from_post(post)
|
def self.create_from_post(post)
|
||||||
if post.created_at == post.updated_at
|
if post.created_at == post.updated_at
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class UserFeedback < ActiveRecord::Base
|
|||||||
scope :positive, where("category = ?", "positive")
|
scope :positive, where("category = ?", "positive")
|
||||||
scope :neutral, where("category = ?", "neutral")
|
scope :neutral, where("category = ?", "neutral")
|
||||||
scope :negative, where("category = ?", "negative")
|
scope :negative, where("category = ?", "negative")
|
||||||
|
scope :for_user, lambda {|user_id| where("user_id = ?", user_id)}
|
||||||
|
|
||||||
def initialize_creator
|
def initialize_creator
|
||||||
self.creator_id = CurrentUser.id
|
self.creator_id = CurrentUser.id
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class WikiPageVersion < ActiveRecord::Base
|
class WikiPageVersion < ActiveRecord::Base
|
||||||
belongs_to :wiki_page
|
belongs_to :wiki_page
|
||||||
belongs_to :updater, :class_name => "User"
|
belongs_to :updater, :class_name => "User"
|
||||||
|
scope :for_user, lambda {|user_id| where("updater_id = ?", user_id)}
|
||||||
|
|
||||||
def updater_name
|
def updater_name
|
||||||
User.id_to_name(updater_id)
|
User.id_to_name(updater_id)
|
||||||
|
|||||||
21
app/presenters/post_set_presenters/base.rb
Normal file
21
app/presenters/post_set_presenters/base.rb
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
module PostSetPresenters
|
||||||
|
class Base
|
||||||
|
def posts
|
||||||
|
raise NotImplementedError
|
||||||
|
end
|
||||||
|
|
||||||
|
def post_previews_html(template)
|
||||||
|
html = ""
|
||||||
|
|
||||||
|
if posts.empty?
|
||||||
|
return template.render(:partial => "post_sets/blank")
|
||||||
|
end
|
||||||
|
|
||||||
|
posts.each do |post|
|
||||||
|
html << PostPresenter.preview(post)
|
||||||
|
end
|
||||||
|
|
||||||
|
html.html_safe
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
module PostSetPresenters
|
module PostSetPresenters
|
||||||
class Favorite
|
class Favorite < Base
|
||||||
attr_accessor :favorite_set, :tag_set_presenter
|
attr_accessor :favorite_set, :tag_set_presenter
|
||||||
delegate :favorites, :posts, :to => :favorite_set
|
delegate :favorites, :to => :favorite_set
|
||||||
|
|
||||||
def initialize(favorite_set)
|
def initialize(favorite_set)
|
||||||
@favorite_set = favorite_set
|
@favorite_set = favorite_set
|
||||||
@@ -16,18 +16,8 @@ module PostSetPresenters
|
|||||||
tag_set_presenter.tag_list_html(template)
|
tag_set_presenter.tag_list_html(template)
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_previews_html(template)
|
def posts
|
||||||
html = ""
|
favorites.map(&:post)
|
||||||
|
|
||||||
if favorites.empty?
|
|
||||||
return template.render(:partial => "post_sets/blank")
|
|
||||||
end
|
|
||||||
|
|
||||||
favorites.each do |favorite|
|
|
||||||
html << PostPresenter.preview(favorite.post)
|
|
||||||
end
|
|
||||||
|
|
||||||
html.html_safe
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
module PostSetPresenters
|
module PostSetPresenters
|
||||||
class Pool
|
class Pool < Base
|
||||||
attr_reader :tag_set_presenter, :pool_set
|
attr_reader :tag_set_presenter, :post_set
|
||||||
|
delegate :posts, :to => :post_set
|
||||||
|
|
||||||
def initialize(pool_set)
|
def initialize(post_set)
|
||||||
@pool_set = pool_set
|
@post_set = post_set
|
||||||
@tag_set_presenter = TagSetPresenter.new(
|
@tag_set_presenter = TagSetPresenter.new(
|
||||||
RelatedTagCalculator.calculate_from_sample_to_array(
|
RelatedTagCalculator.calculate_from_sample_to_array(
|
||||||
pool_set.tag_string
|
post_set.tag_string
|
||||||
).map {|x| x[0]}
|
).map {|x| x[0]}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@@ -14,19 +15,5 @@ module PostSetPresenters
|
|||||||
def tag_list_html(template)
|
def tag_list_html(template)
|
||||||
tag_set_presenter.tag_list_html(template)
|
tag_set_presenter.tag_list_html(template)
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_previews_html(template)
|
|
||||||
html = ""
|
|
||||||
|
|
||||||
if pool_set.posts.empty?
|
|
||||||
return template.render(:partial => "post_sets/blank")
|
|
||||||
end
|
|
||||||
|
|
||||||
pool_set.posts.each do |post|
|
|
||||||
html << PostPresenter.preview(post)
|
|
||||||
end
|
|
||||||
|
|
||||||
html.html_safe
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
34
app/presenters/post_set_presenters/popular.rb
Normal file
34
app/presenters/post_set_presenters/popular.rb
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
module PostSetPresenters
|
||||||
|
class Popular < Base
|
||||||
|
attr_accessor :post_set, :tag_set_presenter
|
||||||
|
delegate :posts, :date, :to => :post_set
|
||||||
|
|
||||||
|
def initialize(post_set)
|
||||||
|
@post_set = post_set
|
||||||
|
end
|
||||||
|
|
||||||
|
def prev_day
|
||||||
|
date - 1
|
||||||
|
end
|
||||||
|
|
||||||
|
def next_day
|
||||||
|
date + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
def prev_week
|
||||||
|
date - 7
|
||||||
|
end
|
||||||
|
|
||||||
|
def next_week
|
||||||
|
date + 7
|
||||||
|
end
|
||||||
|
|
||||||
|
def prev_month
|
||||||
|
1.month.ago(date)
|
||||||
|
end
|
||||||
|
|
||||||
|
def next_month
|
||||||
|
1.month.since(date)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
module PostSetPresenters
|
module PostSetPresenters
|
||||||
class Post
|
class Post < Base
|
||||||
attr_accessor :post_set, :tag_set_presenter
|
attr_accessor :post_set, :tag_set_presenter
|
||||||
|
delegate :posts, :to => :post_set
|
||||||
|
|
||||||
def initialize(post_set)
|
def initialize(post_set)
|
||||||
@post_set = post_set
|
@post_set = post_set
|
||||||
@@ -18,26 +19,8 @@ module PostSetPresenters
|
|||||||
RelatedTagCalculator.calculate_from_sample_to_array(post_set.tag_string).map(&:first)
|
RelatedTagCalculator.calculate_from_sample_to_array(post_set.tag_string).map(&:first)
|
||||||
end
|
end
|
||||||
|
|
||||||
def posts
|
|
||||||
post_set.posts
|
|
||||||
end
|
|
||||||
|
|
||||||
def tag_list_html(template)
|
def tag_list_html(template)
|
||||||
tag_set_presenter.tag_list_html(template)
|
tag_set_presenter.tag_list_html(template)
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_previews_html(template)
|
|
||||||
html = ""
|
|
||||||
|
|
||||||
if posts.empty?
|
|
||||||
return template.render(:partial => "post_sets/blank")
|
|
||||||
end
|
|
||||||
|
|
||||||
posts.each do |post|
|
|
||||||
html << PostPresenter.preview(post)
|
|
||||||
end
|
|
||||||
|
|
||||||
html.html_safe
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
107
app/presenters/user_presenter.rb
Normal file
107
app/presenters/user_presenter.rb
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
class UserPresenter
|
||||||
|
attr_reader :user
|
||||||
|
|
||||||
|
def initialize(user)
|
||||||
|
@user = user
|
||||||
|
end
|
||||||
|
|
||||||
|
def level
|
||||||
|
user.level_string
|
||||||
|
end
|
||||||
|
|
||||||
|
def ban_reason
|
||||||
|
if user.is_banned?
|
||||||
|
"#{user.ban.reason}; expires #{user.ban.expires_at}"
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def tag_subscriptions(template)
|
||||||
|
user.subscriptions.map do |subscription|
|
||||||
|
template.link_to(subscription.name, template.tag_subscription_path(subscription))
|
||||||
|
end.join("; ")
|
||||||
|
end
|
||||||
|
|
||||||
|
def upload_limit
|
||||||
|
deleted_count = Post.for_user(user.id).deleted.count
|
||||||
|
pending_count = Post.for_user(user.id).pending.count
|
||||||
|
approved_count = Post.where("is_flagged = false and is_pending = false and user_id = ?", user.id).count
|
||||||
|
|
||||||
|
if user.base_upload_limit
|
||||||
|
limit = user.base_upload_limit - pending_count
|
||||||
|
string = "base:#{user.base_upload_limit} - pending:#{pending_count}"
|
||||||
|
else
|
||||||
|
limit = 10 + (approved_count / 10) - (deleted_count / 4) - pending_count
|
||||||
|
string = "base:10 + approved:(#{approved_count} / 10) - deleted:(#{deleted_count}) / 4 - pending:#{pending_count}"
|
||||||
|
end
|
||||||
|
|
||||||
|
if limit > 20
|
||||||
|
limit = 20
|
||||||
|
string += " = capped:20"
|
||||||
|
elsif limit < 0
|
||||||
|
limit = 0
|
||||||
|
string += " = capped:0"
|
||||||
|
else
|
||||||
|
string += " = #{limit}"
|
||||||
|
end
|
||||||
|
|
||||||
|
return string
|
||||||
|
end
|
||||||
|
|
||||||
|
def uploads(template)
|
||||||
|
template.link_to(Post.for_user(user.id).count, template.posts_path(:tags => "uploader:#{user.name}"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def deleted_uploads(template)
|
||||||
|
template.link_to(Post.for_user(user.id).deleted.count, template.posts_path(:tags => "status:deleted uploader:#{user.name}"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def favorites(template)
|
||||||
|
template.link_to(Favorite.for_user(user.id).count, template.favorites_path(:user_id => user.id))
|
||||||
|
end
|
||||||
|
|
||||||
|
def comments(template)
|
||||||
|
template.link_to(Comment.for_user(user.id).count, template.comments_path(:search => {:creator_id_eq => user.id}))
|
||||||
|
end
|
||||||
|
|
||||||
|
def post_versions(template)
|
||||||
|
template.link_to(PostVersion.for_user(user.id).count, template.post_versions_path(:search => {:updater_id_eq => user.id}))
|
||||||
|
end
|
||||||
|
|
||||||
|
def note_versions(template)
|
||||||
|
template.link_to(NoteVersion.for_user(user.id).count, template.note_versions_path(:search => {:updater_id_eq => user.id}))
|
||||||
|
end
|
||||||
|
|
||||||
|
def wiki_page_versions(template)
|
||||||
|
template.link_to(WikiPageVersion.for_user(user.id).count, template.wiki_page_versions_path(:search => {:updater_id_eq => user.id}))
|
||||||
|
end
|
||||||
|
|
||||||
|
def forum_posts(template)
|
||||||
|
template.link_to(ForumPost.for_user(user.id).count, template.forum_posts_path(:search => {:creator_id_eq => user.id}))
|
||||||
|
end
|
||||||
|
|
||||||
|
def pool_versions(template)
|
||||||
|
template.link_to(PoolVersion.for_user(user.id).count, template.pool_versions_path(:search => {:updater_id_eq => user.id}))
|
||||||
|
end
|
||||||
|
|
||||||
|
def inviter(template)
|
||||||
|
if user.inviter_id
|
||||||
|
template.link_to(user.inviter.name, template.user_path(user.inviter_id))
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def approvals(template)
|
||||||
|
template.link_to(Post.where("approver_id = ?", user.id).count, template.posts_path(:tags => "approver:#{user.name}"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def feedbacks(template)
|
||||||
|
positive = UserFeedback.for_user(user.id).positive.count
|
||||||
|
neutral = UserFeedback.for_user(user.id).neutral.count
|
||||||
|
negative = UserFeedback.for_user(user.id).negative.count
|
||||||
|
|
||||||
|
template.link_to("positive:#{positive} neutral:#{neutral} negative:#{negative}", user_feedbacks_path(:search => {:user_id_rq => user.id}))
|
||||||
|
end
|
||||||
|
end
|
||||||
19
app/views/explore/posts/_date_explore.html.erb
Normal file
19
app/views/explore/posts/_date_explore.html.erb
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<aside id="sidebar">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<%= link_to "«".html_safe, popular_explore_posts_path(:date => post_set.presenter.prev_day, :scale => "day") %>
|
||||||
|
<%= link_to "»".html_safe, popular_explore_posts_path(:date => post_set.presenter.next_day, :scale => "day") %>
|
||||||
|
<%= link_to "Day", popular_explore_posts_path(:date => post_set.presenter.date, :scale => "day") %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to "«".html_safe, popular_explore_posts_path(:date => post_set.presenter.prev_week, :scale => "week") %>
|
||||||
|
<%= link_to "»".html_safe, popular_explore_posts_path(:date => post_set.presenter.next_week, :scale => "week") %>
|
||||||
|
<%= link_to "Week", popular_explore_posts_path(:date => post_set.presenter.date, :scale => "week") %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to "«".html_safe, popular_explore_posts_path(:date => post_set.presenter.prev_month, :scale => "month") %>
|
||||||
|
<%= link_to "»".html_safe, popular_explore_posts_path(:date => post_set.presenter.next_month, :scale => "month") %>
|
||||||
|
<%= link_to "Month", popular_explore_posts_path(:date => post_set.presenter.date, :scale => "month") %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</aside>
|
||||||
14
app/views/explore/posts/popular.html.erb
Normal file
14
app/views/explore/posts/popular.html.erb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<div id="c-explore-posts">
|
||||||
|
<div id="a-index">
|
||||||
|
<h1>Explore: <%= @post_set.min_date %> – <%= @post_set.max_date %></h1>
|
||||||
|
|
||||||
|
<%= render "date_explore", :post_set => @post_set %>
|
||||||
|
|
||||||
|
<section id="content">
|
||||||
|
<%= @post_set.presenter.post_previews_html(self) %>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= render "posts/partials/common/secondary_links" %>
|
||||||
|
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
<menu>
|
<menu>
|
||||||
<li><%= link_to "Listing", posts_path %></li>
|
<li><%= link_to "Listing", posts_path %></li>
|
||||||
<li><%= link_to "Upload", new_upload_path %></li>
|
<li><%= link_to "Upload", new_upload_path %></li>
|
||||||
<li><%= link_to "Popular", explore_post_popular_path %></li>
|
<li><%= link_to "Popular", popular_explore_posts_path %></li>
|
||||||
<li><%= link_to "Hot", explore_post_hot_path %></li>
|
<li><%= link_to "Hot", posts_path(:tags => "order:rank") %></li>
|
||||||
<% unless CurrentUser.is_anonymous? %>
|
<% unless CurrentUser.is_anonymous? %>
|
||||||
<li><%= link_to "Favorites", favorites_path %></li>
|
<li><%= link_to "Favorites", favorites_path %></li>
|
||||||
<li><%= link_to "Subscriptions", posts_tag_subscription_path(CurrentUser.id) %></li>
|
<li><%= link_to "Subscriptions", posts_tag_subscription_path(CurrentUser.id) %></li>
|
||||||
|
|||||||
@@ -125,9 +125,11 @@ Danbooru::Application.routes.draw do
|
|||||||
resources :wiki_page_versions, :only => [:index, :show]
|
resources :wiki_page_versions, :only => [:index, :show]
|
||||||
|
|
||||||
namespace :explore do
|
namespace :explore do
|
||||||
namespace :post do
|
resources :posts, :only => [:popular, :hot] do
|
||||||
resource :popular, :only => [:show]
|
collection do
|
||||||
resource :hot, :only => [:show]
|
get :popular
|
||||||
|
get :hot
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user