Clean up trips UI

This commit is contained in:
2023-07-01 12:20:03 +10:00
parent 32ae142ce3
commit 250de0c430
6 changed files with 31 additions and 27 deletions

View File

@@ -107,6 +107,10 @@ module Adamantium
end end
end end
def trips
__getobj__.trips
end
private private
# e.g. geo:-37.75188,144.90417;u=35 # e.g. geo:-37.75188,144.90417;u=35

View File

@@ -62,8 +62,8 @@ module Admin
posts posts
.combine(:trips) .combine(:trips)
.where(post_type: %w[post check-in])
.published_between(start_date, end_date) .published_between(start_date, end_date)
.to_a
end end
end end
end end

View File

@@ -1,20 +1,19 @@
div class="mb-8 h-entry" div class="flex-initial w-36 px-8"
td - if added
- if added button class="w-full text-red-200 bg-red-400 hover:bg-red-100 rounded p-2 dark:text-red-900" hx-post="/admin/trips/remove_post" hx-vals='{"trip_id": "#{trip_id}", "post_id": "#{post.id}"}'
button class="text-red-200 bg-red-400 hover:bg-red-100 rounded p-2 dark:text-red-900" hx-post="/admin/trips/remove_post" hx-vals='{"trip_id": "#{trip_id}", "post_id": "#{post.id}"}' = "Remove"
= "Remove" - else
- else button class="w-full text-blue-200 bg-blue-400 hover:bg-blue-100 rounded p-2 dark:text-blue-900" hx-post="/admin/trips/add_post" hx-vals='{"trip_id": "#{trip_id}", "post_id": "#{post.id}"}'
button class="text-blue-200 bg-blue-400 hover:bg-blue-100 rounded p-2 dark:text-blue-900" hx-post="/admin/trips/add_post" hx-vals='{"trip_id": "#{trip_id}", "post_id": "#{post.id}"}' = "Add"
= "Add" div class="flex-initial w-full"
td h3 class="text-xl font-semibold text-blue-600 mb-2"
h3 class="text-xl font-semibold text-blue-600 mb-2" a class="border-b-2 border-transparent hover:border-blue-600 hover:border-b-2" href="/post/#{post.slug}"
a class="border-b-2 border-transparent hover:border-blue-600 hover:border-b-2" href="/post/#{post.slug}" == post.display_title
== post.content div class="e-content prose-p:mb-0 prose-img:my-2 prose-a:text-blue-600 prose-a:no-underline hover:prose-a:underline p-name text-base prose prose-ul:list-none prose-ul:pl-0 prose-li:pl-0 text-gray-800 dark:text-gray-200 prose-a:dark:text-gray-100"
div class="e-content prose-p:mb-0 prose-img:my-2 prose-a:text-blue-600 prose-a:no-underline hover:prose-a:underline p-name text-base prose prose-ul:list-none prose-ul:pl-0 prose-li:pl-0 text-gray-800 dark:text-gray-200 prose-a:dark:text-gray-100" div class="grid gap-4 grid-flow-row grid-cols-4 grid-rows-1"
div class="grid gap-4 grid-flow-row grid-cols-4 grid-rows-1" -post.photos.each do |photo|
-post.photos.each do |photo| img class="w-44 h-44 object-cover rounded" src=photo["value"]
img class="w-44 h-44 object-cover rounded" src=photo["value"]
p class="text-sm text-blue-400" p class="text-sm text-blue-400"
a href="/post/#{post.slug}" a href="/post/#{post.slug}"
= post.published_at = post.published_at

View File

@@ -17,10 +17,9 @@ div class="max-w-prose mx-auto mb-8 border-gray-400 border-b-4"
button class="rounded bg-blue-100 hover:bg-blue-200 text-blue-600 px-2 hover:cursor-pointer" type="submit" button class="rounded bg-blue-100 hover:bg-blue-200 text-blue-600 px-2 hover:cursor-pointer" type="submit"
= "Update" = "Update"
div class="max-w-prose mx-auto" div class="mb-12 max-w-prose mx-auto"
table - posts.each do |post|
- posts.each do |post| div class="flex flex-row"
tr == render "shared/post", post: post, trip_id: trip.id, added: post.trips.map(&:id).include?(trip.id)
== render "shared/post", post: post, trip_id: trip.id, added: post.trips.map(&:id).include?(trip.id)
div class="max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600" div class="max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600"

View File

@@ -9,7 +9,9 @@ module Admin
end end
expose :posts do |trip| expose :posts do |trip|
post_repo.created_between(trip.start_date, trip.end_date) post_repo.created_between(trip.start_date, trip.end_date).map do |post|
Adamantium::Decorators::Posts::Decorator.new(post)
end
end end
end end
end end

View File

@@ -3,7 +3,7 @@
const colors = require("tailwindcss/colors"); const colors = require("tailwindcss/colors");
module.exports = { module.exports = {
content: ["./app/templates/**/*.slim", "./public/assets/index.js", "app/decorators/*/decorator.rb"], content: ["./app/templates/**/*.slim", "./slices/admin/templates/**/*.slim", "./public/assets/index.js", "app/decorators/*/decorator.rb"],
theme: { theme: {
fontSize: { fontSize: {
xsm: '0.75rem', xsm: '0.75rem',