add most viewed posts page
This commit is contained in:
17
app/logical/post_sets/most_viewed.rb
Normal file
17
app/logical/post_sets/most_viewed.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
module PostSets
|
||||
class MostViewed < PostSets::Base
|
||||
attr_reader :date
|
||||
|
||||
def initialize(date)
|
||||
@date = date.blank? ? Time.zone.now : Time.zone.parse(date)
|
||||
end
|
||||
|
||||
def posts
|
||||
@posts ||= PostViewCountService.new.popular_posts(date)
|
||||
end
|
||||
|
||||
def presenter
|
||||
::PostSetPresenters::MostViewed.new(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user