Add trips
This commit is contained in:
@@ -24,6 +24,10 @@ module Adamantium
|
||||
expose :photo_posts do |past_posts|
|
||||
past_posts.select(&:photos?)
|
||||
end
|
||||
|
||||
expose :trip do |post|
|
||||
post.trips.first
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
13
app/views/trips/index.rb
Normal file
13
app/views/trips/index.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Trips
|
||||
class Index < View
|
||||
include Deps["repos.trip_repo"]
|
||||
|
||||
expose :trips do
|
||||
trip_repo.list
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
21
app/views/trips/show.rb
Normal file
21
app/views/trips/show.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
module Adamantium
|
||||
module Views
|
||||
module Trips
|
||||
class Show < Adamantium::View
|
||||
include Deps[
|
||||
"repos.trip_repo"
|
||||
]
|
||||
|
||||
expose :posts do |trip|
|
||||
trip.posts.sort { |p, x| p.published_at.to_i <=> x.published_at.to_i }.map do |post|
|
||||
Decorators::Posts::Decorator.new(post)
|
||||
end
|
||||
end
|
||||
|
||||
expose :trip do |id:|
|
||||
trip_repo.fetch!(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user