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

@@ -1,17 +1,7 @@
<%# date, selected_scale, scale %>
<%# path, date, scale, %>
<span class="period">
<% if selected_scale == scale %>
<%= link_to "« prev", popular_explore_posts_path(date: prev_date_for_scale(date, scale), scale: scale), id: "paginator-prev", rel: "prev", "data-shortcut": "a left" %>
<% else %>
<%= link_to "« prev", popular_explore_posts_path(date: prev_date_for_scale(date, scale), scale: scale) %>
<% end %>
<%= link_to scale.capitalize, popular_explore_posts_path(date: date, scale: scale), class: "desc" %>
<% if selected_scale == scale %>
<%= link_to "next »", popular_explore_posts_path(date: next_date_for_scale(date, scale), scale: scale), id: "paginator-next", rel: "next", "data-shortcut": "d right" %>
<% else %>
<%= link_to "next »", popular_explore_posts_path(date: next_date_for_scale(date, scale), scale: scale) %>
<% end %>
</span>
<p class="date-nav-links">
<%= render "explore/posts/nav_links_for_scale", path: path, date: date, selected_scale: scale, scale: "day" %>
<%= render "explore/posts/nav_links_for_scale", path: path, date: date, selected_scale: scale, scale: "week" %>
<%= render "explore/posts/nav_links_for_scale", path: path, date: date, selected_scale: scale, scale: "month" %>
</p>

View File

@@ -0,0 +1,17 @@
<%# path, date, selected_scale, scale %>
<span class="period">
<% if selected_scale == scale %>
<%= link_to "« prev", send(path, date: prev_date_for_scale(date, scale), scale: scale), id: "paginator-prev", rel: "prev", "data-shortcut": "a left" %>
<% else %>
<%= link_to "« prev", send(path, date: prev_date_for_scale(date, scale), scale: scale) %>
<% end %>
<%= link_to scale.capitalize, send(path, date: date, scale: scale), class: "desc" %>
<% if selected_scale == scale %>
<%= link_to "next »", send(path, date: next_date_for_scale(date, scale), scale: scale), id: "paginator-next", rel: "next", "data-shortcut": "d right" %>
<% else %>
<%= link_to "next »", send(path, date: next_date_for_scale(date, scale), scale: scale) %>
<% end %>
</span>

View File

@@ -0,0 +1,15 @@
<% page_title "Curated Posts" %>
<% meta_description "The best posts of #{date_range_description(@date, @scale, @min_date, @max_date)}" %>
<%= render "posts/partials/common/secondary_links" %>
<div id="c-explore-posts">
<div id="a-curated">
<h1>Curated: <%= date_range_description(@date, @scale, @min_date, @max_date) %></h1>
<%= render "explore/posts/nav_links", path: :curated_explore_posts_path, date: @date, scale: @scale %>
<%= render "posts/partials/common/inline_blacklist" %>
<%= post_previews_html(@posts) %>
</div>
</div>

View File

@@ -1,28 +1,13 @@
<% page_title "Popular Posts" %>
<% meta_description "The most popular posts per #{@scale}" %>
<% meta_description "The most popular posts of #{date_range_description(@date, @scale, @min_date, @max_date)}" %>
<%= render "posts/partials/common/secondary_links" %>
<div id="c-explore-posts">
<div id="a-popular">
<h1>
Popular:
<% if @scale == "day" %>
<%= @date.strftime("%B %d, %Y") %>
<% elsif @scale == "week" %>
<%= @min_date.strftime("%B %d, %Y") %> - <%= @max_date.strftime("%B %d, %Y") %>
<% elsif @scale == "month" %>
<%= @date.strftime("%B %Y") %>
<% end %>
</h1>
<p id="popular-nav-links">
<%= render "explore/posts/nav_links", date: @date, selected_scale: @scale, scale: "day" %>
<%= render "explore/posts/nav_links", date: @date, selected_scale: @scale, scale: "week" %>
<%= render "explore/posts/nav_links", date: @date, selected_scale: @scale, scale: "month" %>
</p>
<h1>Popular: <%= date_range_description(@date, @scale, @min_date, @max_date) %></h1>
<%= render "explore/posts/nav_links", path: :popular_explore_posts_path, date: @date, scale: @scale %>
<%= render "posts/partials/common/inline_blacklist" %>
<%= post_previews_html(@posts) %>