Add photos
This commit is contained in:
13
app/actions/photos/index.rb
Normal file
13
app/actions/photos/index.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
module Adamantium
|
||||||
|
module Actions
|
||||||
|
module Photos
|
||||||
|
class Index < Action
|
||||||
|
include Deps["views.photos.index"]
|
||||||
|
|
||||||
|
def handle(req, res)
|
||||||
|
res.render index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@@ -1,2 +1,4 @@
|
|||||||
Hi! 👋 I'm Daniel, a software engineer living in Canberra, Australia.
|
Hi! 👋 I'm Daniel, a software engineer living in Canberra, Australia.
|
||||||
|
|
||||||
|
Welcome to my personal site! This is where I post the things I have [written](/posts), the [photos](/photos) I have taken, the [bookmarks](/bookmarks) I have saved, and the [places](/places) I have been.
|
||||||
|
|
||||||
|
@@ -64,7 +64,7 @@ module Adamantium
|
|||||||
|
|
||||||
def photo_listing(limit: nil)
|
def photo_listing(limit: nil)
|
||||||
posts
|
posts
|
||||||
.where(post_type: "post")
|
.where(post_type: ["post", "checkin"])
|
||||||
.where(Sequel[:photos].pg_json.array_length > 0)
|
.where(Sequel[:photos].pg_json.array_length > 0)
|
||||||
.published
|
.published
|
||||||
.combine(:tags)
|
.combine(:tags)
|
||||||
|
8
app/templates/photos/index.html.slim
Normal file
8
app/templates/photos/index.html.slim
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:text-gray-200"
|
||||||
|
h1 Photos
|
||||||
|
|
||||||
|
div class="grid grid-cols-3 gap-4 mb-4 max-w-prose mx-auto"
|
||||||
|
- photos.each do |post|
|
||||||
|
== render :photo_post, post: post
|
||||||
|
|
||||||
|
div class="max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600"
|
15
app/views/photos/index.rb
Normal file
15
app/views/photos/index.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
module Adamantium
|
||||||
|
module Views
|
||||||
|
module Photos
|
||||||
|
class Index < Adamantium::View
|
||||||
|
include Deps["repos.post_repo"]
|
||||||
|
|
||||||
|
expose :photos do
|
||||||
|
post_repo.photo_listing.map do |post|
|
||||||
|
Decorators::Posts::Decorator.new(post)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Reference in New Issue
Block a user