Refactor app in to its own slice
This commit is contained in:
21
slices/main/views/posts/archive.rb
Normal file
21
slices/main/views/posts/archive.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
module Main
|
||||
module Views
|
||||
module Posts
|
||||
class Archive< Main::View
|
||||
include Deps["repos.post_repo"]
|
||||
|
||||
expose :year do |year:|
|
||||
year
|
||||
end
|
||||
|
||||
expose :posts do |year:|
|
||||
post_repo.by_year(year: year).map { |post| Decorators::Posts::Decorator.new(post) }
|
||||
end
|
||||
|
||||
expose :post_years do
|
||||
post_repo.post_years.map { |py| py[:year].to_i }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user