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:
evazion
2020-02-23 16:43:06 -06:00
parent e8590afa6d
commit 463b1b734e
12 changed files with 79 additions and 35 deletions

View File

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