]> gitweb.mndrdr.org Git - arelpe.git/commitdiff
Rudamentary implementation of thoughts for short posts
authorAidan Cornelius-Bell <[email protected]>
Thu, 3 Oct 2024 21:32:05 +0000 (07:02 +0930)
committerAidan Cornelius-Bell <[email protected]>
Thu, 3 Oct 2024 21:32:05 +0000 (07:02 +0930)
app/assets/stylesheets/application.css
app/models/post.rb
app/views/.DS_Store
app/views/posts/_form.html.erb
app/views/pubview/index.html.erb
app/views/pubview/post.html.erb

index efaa82f098fa83e13c150a9760080355246f07b8..3c95e20b576dbaddcbf9683c911351b23f286daa 100644 (file)
@@ -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;
index faff1f1c93d9915bc1529d2ce12b6136030d6ffe..0eea2f00802ca98206d249aa41babd20f2fb0a81 100644 (file)
@@ -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)
index 17558727d6ad1b7c3a7b504413754349481d4e45..90d4b9ee8db02ac0564b1f3d69565a66a974b073 100644 (file)
Binary files a/app/views/.DS_Store and b/app/views/.DS_Store differ
index 3595cf332b50686c3e08e69cdada3bce938633ea..aeb5e90498553ebdc802f7d0865785891618a71d 100644 (file)
@@ -37,7 +37,7 @@
 
   <div class="field bookmark-field" style="display: none;">
     <%= form.label :url %>
-    <%= form.url_field :url, onblur: 'fetchTitle()' %>
+    <%= form.url_field :url %>
   </div>
 
   <div class="actions">
@@ -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();
index 06eb2cb533dee99fc39b12c02737db264cb58bfa..30e64bb2d0e03129b1b3aa5caea8842a3620f5b4 100644 (file)
@@ -24,7 +24,7 @@
 <div class="post">
   <ul class="container">
        <% @items.each do |item| %>
-         <li class="<%= item.post_type %>-item">
+         <li class="<%= item.post_type %>-item<%= if item.short_dispatch? then " thought-item" end %>">
                <% if item.dispatch? %>
                  <span class="post-link">
                        <%= link_to item.title, public_post_path(year: item.published_at.year, slug: item.slug) %>
                  </span>
                  <span class="dash">&mdash;</span>
                  <span class="meta">posted <%= item.published_at.strftime('%d/%m/%y') %>, tagged as <%= raw item.format_tags %></span>
-                 <blockquote class="excerpt"><%= item.generate_excerpt %>...</blockquote>
+                 <% if item.short_dispatch? %>
+                       <blockquote class="full-content">
+                         <%= raw item.rendered_content.html_safe %>
+                       </blockquote>
+                 <% else %>
+                   <blockquote class="excerpt"><%= item.generate_excerpt %>...</blockquote>
+                 <% end %>
                <% else %>
                  <span class="post-link">
                        <%= link_to item.title, item.url, target: "_blank" %>
index c7c783404409d454871550219b7b42351ac7f055..8dc884944d235c38cd96837d8f6da5e82222f8e0 100644 (file)
@@ -8,7 +8,7 @@
   <h1><%= @post.title %></h1>
   <%= link_to "↼ Back to some other dispatches...", "#{root_path}?filter=posts" %>
   <div class="postmeta">
-       <p>Posted <%= @post.published_at.strftime('%B %d, %Y') %> and tagged <%= raw @post.format_tags %> Reading Time: about <%= @reading_time %> minute(s).</p>
+       <p>Posted <%= @post.published_at.strftime('%B %d, %Y') %> and tagged <%= raw @post.format_tags %> <% if [email protected]_dispatch?%>Reading Time: about <%= @reading_time %> minute(s).<% end %></p>
   </div>
 </div>
 
 </div>
 
 <div class="container" id="bottom">
+  <% if [email protected]_dispatch?%>
   <h3>Follow via email</h3>
   <iframe scrolling="no" style="width:100%!important;height:220px;border:1px #ccc solid !important" src="https://buttondown.email/acb?as_embed=true"></iframe><br>
   <h3>More stuff from Aidan</h3>
   <p><span class="callout">→ Circular economy</span>: if this work has been of interest to you, please consider subsidising my existence, <em>no subscriptions</em>: <%= link_to "click here to donate with PayPal <abbr title=\"external link\">&nearr;&#xFE0E;</abbr>".html_safe, "https://paypal.me/aidancornelius/10.00/" %> or <%= link_to "here for more options and information <abbr title=\"external link\">&swarr;&#xFE0E;</abbr>".html_safe, "/sponsor/" %>.</p>
   <p><span class="callout">→ Stay updated</span>: 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 <abbr title=\"internal link\">&swarr;&#xFE0E;</abbr>".html_safe, "https://mndrdr.org/feed/dispatches/" %> to keep your inbox sanity.</p>
+  <% end %>
   <p><%= link_to "↑ Back to top", "#top" %> or <%= link_to "↼ Back to some other dispatches...", "#{root_path}?filter=posts" %></p>
 </div>
\ No newline at end of file