From: Aidan Cornelius-Bell Date: Thu, 3 Oct 2024 21:32:05 +0000 (+0930) Subject: Rudamentary implementation of thoughts for short posts X-Git-Url: https://gitweb.mndrdr.org/?a=commitdiff_plain;h=37b08976ffd9a67fff4a8b0ae8dac641318dca52;p=arelpe.git Rudamentary implementation of thoughts for short posts --- diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index efaa82f..3c95e20 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -147,6 +147,11 @@ blockquote { color: var(--dark-text); } +.full-content p { + text-indent: 0em; + color: var(--light-text); +} + code { font-family: monospace; background-color: var(--post-bg); @@ -327,6 +332,11 @@ ul .bookmark-item::before { font-variant-emoji: text; } +ul .thought-item::before { + content: "☭\FE0E"; + font-variant-emoji: text; +} + ul .pinned::before { content: "✯\FE0E"; font-variant-emoji: text; diff --git a/app/models/post.rb b/app/models/post.rb index faff1f1..0eea2f0 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -38,6 +38,13 @@ class Post < ApplicationRecord def bookmark? post_type == 'bookmark' end + + def short_dispatch? + dispatch? && + content.present? && + content.split.size <= 150 && + !content.strip.start_with?("Dear friends,") + end def rendered_content MarkdownRenderer.render(content) diff --git a/app/views/.DS_Store b/app/views/.DS_Store index 1755872..90d4b9e 100644 Binary files a/app/views/.DS_Store and b/app/views/.DS_Store differ diff --git a/app/views/posts/_form.html.erb b/app/views/posts/_form.html.erb index 3595cf3..aeb5e90 100644 --- a/app/views/posts/_form.html.erb +++ b/app/views/posts/_form.html.erb @@ -37,7 +37,7 @@
@@ -69,13 +69,6 @@ function initializeSimpleMDE() { } } -function fetchTitle() { - var url = document.getElementById('post_url').value; - if (url && document.getElementById('post_title').value === '') { - document.getElementById('post_title').value = 'Title for ' + url; - } -} - document.addEventListener('DOMContentLoaded', function() { console.log("DOM loaded"); toggleFields(); diff --git a/app/views/pubview/index.html.erb b/app/views/pubview/index.html.erb index 06eb2cb..30e64bb 100644 --- a/app/views/pubview/index.html.erb +++ b/app/views/pubview/index.html.erb @@ -24,7 +24,7 @@
    <% @items.each do |item| %> -
  • +
  • "> <% if item.dispatch? %> <%= link_to item.title, public_post_path(year: item.published_at.year, slug: item.slug) %> @@ -32,7 +32,13 @@ posted <%= item.published_at.strftime('%d/%m/%y') %>, tagged as <%= raw item.format_tags %> -
    <%= item.generate_excerpt %>...
    + <% if item.short_dispatch? %> +
    + <%= raw item.rendered_content.html_safe %> +
    + <% else %> +
    <%= item.generate_excerpt %>...
    + <% end %> <% else %> <%= link_to item.title, item.url, target: "_blank" %> diff --git a/app/views/pubview/post.html.erb b/app/views/pubview/post.html.erb index c7c7834..8dc8849 100644 --- a/app/views/pubview/post.html.erb +++ b/app/views/pubview/post.html.erb @@ -8,7 +8,7 @@

    <%= @post.title %>

    <%= link_to "↼ Back to some other dispatches...", "#{root_path}?filter=posts" %>
@@ -19,10 +19,12 @@
+ <% if !@post.short_dispatch?%>

Follow via email


More stuff from Aidan

→ Circular economy: if this work has been of interest to you, please consider subsidising my existence, no subscriptions: <%= link_to "click here to donate with PayPal ↗︎".html_safe, "https://paypal.me/aidancornelius/10.00/" %> or <%= link_to "here for more options and information ↙︎".html_safe, "/sponsor/" %>.

→ Stay updated: email masochists amongst us may receive my dispatches directly in their inbox with the form below. Alternatively, you are able to subscribe in an RSS reader via the <%= link_to "feed ↙︎".html_safe, "https://mndrdr.org/feed/dispatches/" %> to keep your inbox sanity.

+ <% end %>

<%= link_to "↑ Back to top", "#top" %> or <%= link_to "↼ Back to some other dispatches...", "#{root_path}?filter=posts" %>

\ No newline at end of file