fixes #2454: Add a new popular posts page for view counts

This commit is contained in:
r888888888
2015-07-24 15:55:24 -07:00
parent cb57b08d54
commit cc6da3ff89
8 changed files with 145 additions and 3 deletions

View File

@@ -79,6 +79,7 @@ class PostPresenter < Presenter
data-parent-id="#{post.parent_id}"
data-has-children="#{post.has_children?}"
data-score="#{post.score}"
data-views="#{post.view_count}"
data-fav-count="#{post.fav_count}"
data-pixiv-id="#{post.pixiv_id}"
data-md5="#{post.md5}"

View File

@@ -0,0 +1,38 @@
module PostSetPresenters
class PopularView < Popular
def initialize(post_set)
@post_set = post_set
end
def nav_links_for_scale(template, scale)
html = []
html << '<span class="period">'
html << template.link_to(
"&laquo;prev".html_safe,
template.popular_explore_post_views_path(
:date => prev_date_for_scale(scale),
:scale => scale.downcase
),
:rel => (link_rel_for_scale?(template, scale.downcase) ? "prev" : nil)
)
html << template.link_to(
scale,
template.popular_explore_post_views_path(
:date => date,
:scale => scale.downcase
),
:class => "desc"
)
html << template.link_to(
"next&raquo;".html_safe,
template.popular_explore_post_views_path(
:date => next_date_for_scale(scale),
:scale => scale.downcase
),
:rel => (link_rel_for_scale?(template, scale.downcase) ? "next" : nil)
)
html << '</span>'
html.join("\n").html_safe
end
end
end