From 6544a27f24f136ee40cfb5d6c1ab78321ca6ebce Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Thu, 23 Feb 2023 21:53:30 +1100 Subject: [PATCH] Place post styles --- app/content/pages/colophon.md | 18 ++++++++++++++++++ app/decorators/posts/decorator.rb | 10 ++++++++++ app/templates/posts/show.html.slim | 2 +- app/templates/shared/_photo_post.html.slim | 5 +++-- app/templates/shared/_post.html.slim | 2 +- 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 app/content/pages/colophon.md diff --git a/app/content/pages/colophon.md b/app/content/pages/colophon.md new file mode 100644 index 0000000..6af2ead --- /dev/null +++ b/app/content/pages/colophon.md @@ -0,0 +1,18 @@ +# Colophon + +Hello! Welcome to dnitza.com 👋 + + + +This site is made from: + +- Adamantium — A custom-built, [Hanami](https://github.com/hanami/hanami)-based, blogging engine [based on the Micropub spec](https://www.w3.org/TR/micropub/) (open sourced soon). +- [Vultr](http://vultr.com/) — for hosting. +- [Vim](https://www.vim.org) — for moving text around in files. +- [Postico](https://eggerapps.at/postico) — for looking at the mistakes I have made in postgres. +- [iTerm2](http://iterm2.com/) — as my terminal emulator. +- [Tailwind](https://tailwindcss.com) — for stylin'. +- [HTMX](http://htmx.org/) — for some JS sprinkles. +- [Rubik](https://fonts.google.com/specimen/Rubik) — for headings. +- [JetBrains Mono](https://www.jetbrains.com/lp/mono/) — for code snippets. +- [Karla](https://fonts.google.com/specimen/Karla?query=KARLA) — for everything else. diff --git a/app/decorators/posts/decorator.rb b/app/decorators/posts/decorator.rb index deaad60..1aefcc6 100644 --- a/app/decorators/posts/decorator.rb +++ b/app/decorators/posts/decorator.rb @@ -63,6 +63,14 @@ module Adamantium geo[1] end + def small_map + "https://api.mapbox.com/styles/v1/dnitza/cleb2o734000k01pbifls5620/static/pin-s+555555(#{lon},#{lat})/#{lon},#{lat},14,0/200x100@2x?access_token=pk.eyJ1IjoiZG5pdHphIiwiYSI6ImNsZWIzOHFmazBkODIzdm9kZHgxdDF4ajQifQ.mSneE-1SKeju8AOz5gp4BQ" + end + + def large_map + "https://api.mapbox.com/styles/v1/dnitza/cleb2o734000k01pbifls5620/static/pin-s+555555(#{lon},#{lat})/#{lon},#{lat},14,0/620x310@2x?access_token=pk.eyJ1IjoiZG5pdHphIiwiYSI6ImNsZWIzOHFmazBkODIzdm9kZHgxdDF4ajQifQ.mSneE-1SKeju8AOz5gp4BQ" + end + private # e.g. geo:-37.75188,144.90417;u=35 @@ -74,6 +82,8 @@ module Adamantium end def truncate_html(content, len = 30, at_end = nil) + return content if content.to_s.length <= len + p = REXML::Parsers::PullParser.new(content) tags = [] new_len = len diff --git a/app/templates/posts/show.html.slim b/app/templates/posts/show.html.slim index 5eb5e09..38e711b 100644 --- a/app/templates/posts/show.html.slim +++ b/app/templates/posts/show.html.slim @@ -15,7 +15,7 @@ article class="h-entry" == post.content - if post.location - img class="shadow-solid shadow-pink-100 dark:shadow-pink-200 rounded mb-4" src="https://api.mapbox.com/styles/v1/dnitza/cleb2o734000k01pbifls5620/static/pin-l+555555(#{post.lon},#{post.lat})/#{post.lon},#{post.lat},14,0/400x200@2x?access_token=pk.eyJ1IjoiZG5pdHphIiwiYSI6ImNsZWIzOHFmazBkODIzdm9kZHgxdDF4ajQifQ.mSneE-1SKeju8AOz5gp4BQ" + img class="shadow-solid shadow-pink-100 dark:shadow-pink-200 rounded mb-4" src=post.large_map div class="mb-4 max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600" diff --git a/app/templates/shared/_photo_post.html.slim b/app/templates/shared/_photo_post.html.slim index b97a216..3341d2c 100644 --- a/app/templates/shared/_photo_post.html.slim +++ b/app/templates/shared/_photo_post.html.slim @@ -1,2 +1,3 @@ -a href="#{post.permalink}" - img class="rounded object-cover hover:opacity-80 h-48 w-48 mr-4 mb-4" src="#{post.photos[0]["value"]}" alt="#{post.photos[0]["alt"]}" +div class="rounded max-w-xs" + a href="#{post.permalink}" + img class="rounded object-cover hover:opacity-80 h-48 w-48 mr-4 mb-4" src="#{post.photos[0]["value"]}" alt="#{post.photos[0]["alt"]}" diff --git a/app/templates/shared/_post.html.slim b/app/templates/shared/_post.html.slim index d7be600..d1bf5e6 100644 --- a/app/templates/shared/_post.html.slim +++ b/app/templates/shared/_post.html.slim @@ -5,7 +5,7 @@ div class="mb-8 h-entry" div class="e-content p-name text-base prose prose-ul:list-none prose-ul:pl-0 prose-li:pl-0 text-gray-800 dark:text-gray-200" == post.excerpt -if post.location - img src="https://api.mapbox.com/styles/v1/dnitza/cleb2o734000k01pbifls5620/static/#{post.lat},#{post.lon},14,0/50x50@2x?access_token=pk.eyJ1IjoiZG5pdHphIiwiYSI6ImNsZWIzOHFmazBkODIzdm9kZHgxdDF4ajQifQ.mSneE-1SKeju8AOz5gp4BQ" + img class="rounded" src=post.small_map == render :tags, tags: post.tags p class="text-sm text-blue-400"