Add last location to home page
This commit is contained in:
@@ -26,12 +26,12 @@ module Adamantium
|
||||
end
|
||||
|
||||
def prefix_emoji
|
||||
prefix = name ? "" : "📯"
|
||||
prefix = name ? "" : "💬"
|
||||
location ? "🗺️" : prefix
|
||||
end
|
||||
|
||||
def display_title
|
||||
title = name || published_at.strftime("%D")
|
||||
title = name
|
||||
"#{prefix_emoji} #{title}"
|
||||
end
|
||||
|
||||
|
@@ -93,6 +93,15 @@ module Adamantium
|
||||
query ? base.where(Sequel.ilike(:name, "%#{query}%")).to_a : base.to_a
|
||||
end
|
||||
|
||||
def last_location
|
||||
posts
|
||||
.where(post_type: "checkin")
|
||||
.published
|
||||
.order(Sequel.desc(:published_at))
|
||||
.limit(1)
|
||||
.one
|
||||
end
|
||||
|
||||
def for_rss
|
||||
posts
|
||||
.where(post_type: "post", location: nil)
|
||||
|
@@ -7,5 +7,6 @@ div class="mb-8 h-entry"
|
||||
== render :tags, tags: post.tags
|
||||
|
||||
p class="text-sm text-blue-400"
|
||||
a href="#{post.permalink}"
|
||||
time class="dt-published" datetime=post.machine_published_at
|
||||
= post.display_published_at
|
||||
|
@@ -5,15 +5,24 @@ div class="h-card prose dark:prose-invert mb-12 max-w-prose mx-auto text-gray-80
|
||||
div class="mb-8 max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600"
|
||||
|
||||
div class="mb-4 flex max-w-prose mx-auto"
|
||||
h2 class="text-xl text-gray-600 dark:text-gray-200" Recent
|
||||
h2 class="text-l text-gray-600 dark:text-gray-200" Recent posts
|
||||
a class="text-right flex-1 text-blue-400" href="/posts" See all →
|
||||
|
||||
div class="mb-12 max-w-prose mx-auto"
|
||||
- posts.each do |post|
|
||||
== render :post, post: post
|
||||
|
||||
div class="flex max-w-prose mx-auto"
|
||||
h2 class="text-l text-gray-600 dark:text-gray-200" Photos
|
||||
a class="text-right flex-1 text-blue-400" href="/photos" See all →
|
||||
|
||||
div class="grid grid-cols-3 gap-4 mb-4 max-w-prose mx-auto"
|
||||
- photo_posts.each do |post|
|
||||
== render :photo_post, post: post
|
||||
|
||||
div class="mb-12 max-w-prose mx-auto"
|
||||
p
|
||||
= "🌏 Last seen at "
|
||||
a class="text-blue-400" href=last_location.permalink
|
||||
= last_location.display_title
|
||||
div class="max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600"
|
||||
|
@@ -21,6 +21,10 @@ module Adamantium
|
||||
Decorators::Posts::Decorator.new(post)
|
||||
end
|
||||
end
|
||||
|
||||
expose :last_location do
|
||||
Decorators::Posts::Decorator.new(post_repo.last_location)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -1475,6 +1475,11 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
|
||||
color: rgb(251 146 60 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.hover\:text-blue-600:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(37 99 235 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.hover\:underline:hover {
|
||||
text-decoration-line: underline;
|
||||
}
|
||||
@@ -1671,6 +1676,11 @@ h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
|
||||
background-color: rgb(250 204 21 / 0.8);
|
||||
}
|
||||
|
||||
.dark\:hover\:text-blue-200:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(191 219 254 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.dark\:hover\:text-yellow-100:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(254 249 195 / var(--tw-text-opacity));
|
||||
|
Reference in New Issue
Block a user