better range text for explore popular
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
module PostSetPresenters
|
module PostSetPresenters
|
||||||
class Popular < Base
|
class Popular < Base
|
||||||
attr_accessor :post_set, :tag_set_presenter
|
attr_accessor :post_set, :tag_set_presenter
|
||||||
delegate :posts, :date, :to => :post_set
|
delegate :posts, :date, :min_date, :max_date, :to => :post_set
|
||||||
|
|
||||||
def initialize(post_set)
|
def initialize(post_set)
|
||||||
@post_set = post_set
|
@post_set = post_set
|
||||||
@@ -30,5 +30,15 @@ module PostSetPresenters
|
|||||||
def next_month
|
def next_month
|
||||||
1.month.since(date)
|
1.month.since(date)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def range_text
|
||||||
|
if min_date == max_date
|
||||||
|
date.strftime("%B %d, %Y")
|
||||||
|
elsif max_date - min_date == 6
|
||||||
|
min_date.strftime("Week of %B %d, %Y")
|
||||||
|
else
|
||||||
|
date.strftime("Month of %B %Y")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div id="c-explore-posts">
|
<div id="c-explore-posts">
|
||||||
<div id="a-index">
|
<div id="a-index">
|
||||||
<h1>Explore: <%= @post_set.min_date %> – <%= @post_set.max_date %></h1>
|
<h1>Explore: <%= @post_set.presenter.range_text %></h1>
|
||||||
|
|
||||||
<%= render "date_explore", :post_set => @post_set %>
|
<%= render "date_explore", :post_set => @post_set %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user