Add curated posts page.
Add a curated posts page at /explore/posts/curated. Curated posts are the most favorited posts by contributor-level users (users with unlimited upload permissions). Also add an order:curated tag using for use in regular searches.
This commit is contained in:
@@ -11,6 +11,15 @@ module Explore
|
||||
respond_with(@posts)
|
||||
end
|
||||
|
||||
def curated
|
||||
@date, @scale, @min_date, @max_date = parse_date(params)
|
||||
|
||||
limit = params.fetch(:limit, CurrentUser.user.per_page)
|
||||
@posts = curated_posts(@min_date, @max_date).paginate(params[:page], limit: limit)
|
||||
|
||||
respond_with(@posts)
|
||||
end
|
||||
|
||||
def viewed
|
||||
@date, @scale, @min_date, @max_date = parse_date(params)
|
||||
@posts = PostViewCountService.new.popular_posts(@date)
|
||||
@@ -40,5 +49,9 @@ module Explore
|
||||
def popular_posts(min_date, max_date)
|
||||
Post.where(created_at: min_date..max_date).tag_match("order:score")
|
||||
end
|
||||
|
||||
def curated_posts(min_date, max_date)
|
||||
Post.where(created_at: min_date..max_date).tag_match("order:curated")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user