diff --git a/app/actions/photos/index.rb b/app/actions/photos/index.rb new file mode 100644 index 0000000..c96457c --- /dev/null +++ b/app/actions/photos/index.rb @@ -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 diff --git a/app/content/home.md b/app/content/home.md index dda65f6..e3e621d 100644 --- a/app/content/home.md +++ b/app/content/home.md @@ -1,2 +1,4 @@ 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. + diff --git a/app/repos/post_repo.rb b/app/repos/post_repo.rb index b32fc20..01a8174 100644 --- a/app/repos/post_repo.rb +++ b/app/repos/post_repo.rb @@ -64,7 +64,7 @@ module Adamantium def photo_listing(limit: nil) posts - .where(post_type: "post") + .where(post_type: ["post", "checkin"]) .where(Sequel[:photos].pg_json.array_length > 0) .published .combine(:tags) diff --git a/app/templates/photos/index.html.slim b/app/templates/photos/index.html.slim new file mode 100644 index 0000000..1311985 --- /dev/null +++ b/app/templates/photos/index.html.slim @@ -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" diff --git a/app/views/photos/index.rb b/app/views/photos/index.rb new file mode 100644 index 0000000..46295ba --- /dev/null +++ b/app/views/photos/index.rb @@ -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