]> gitweb.mndrdr.org Git - arelpe.git/commitdiff
Group posts by date with a heading and some divider spacing; some css tweaks
authorAidan Cornelius-Bell <[email protected]>
Mon, 18 Nov 2024 06:42:45 +0000 (17:12 +1030)
committerAidan Cornelius-Bell <[email protected]>
Mon, 18 Nov 2024 06:42:45 +0000 (17:12 +1030)
app/assets/stylesheets/application.css
app/views/pubview/index.html.erb
app/views/pubview/post.html.erb

index 21cc74d189ee66fe1c7ca49658c5c5bb9c3bf72f..c40fba69a9c1548f4b47549a0c88cec23b96a582 100644 (file)
@@ -350,6 +350,14 @@ footer p {
     margin-right: 1px;
 }
 
+.lowlight a:active,
+.lowlight a:hover,
+.lowlight a:visited,
+.lowlight a {
+    color: var(--quote-bg);
+    text-decoration: none;
+}
+
 ul li {
     list-style: none;
     margin-left: 2em;
@@ -437,12 +445,23 @@ ul .pinned::before {
     font-size: 0.9em;
 }
 
-.bookmark-item {
-    padding-bottom: 15px;
+.bookmark-item,
+.dispatch-item {
+    margin-bottom: 1em;
 }
 
-.dispatch-item {
-    padding-bottom: 5px;
+.date-heading:first-of-type {
+    margin-top: 0em;
+    margin-bottom: 0.5em;
+    font-weight: 500;
+    color: var(--dark-text);
+}
+
+.date-heading {
+    margin-top: 2.5em;
+    margin-bottom: 0.5em;
+    font-weight: 500;
+    color: var(--dark-text);
 }
 
 table {
index f2431e1e46da03c365622f8b56cf43d9f7a40f7f..23e0232476560ba44d5c06768f755ba3604bde18 100644 (file)
 
 <div class="post">
   <ul class="container">
-       <% @items.each do |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) %>
-                       <abbr title="internal link">&swarr;&#xFE0E;</abbr>
-                 </span>
-                 <span class="dash">&mdash;</span>
-                 <span class="meta">posted <%= item.published_at.strftime('%d/%m/%y') %>, tagged as <%= raw item.format_tags %></span>
-                 <% 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" %>
-                       <abbr title="external link">&nearr;&#xFE0E;</abbr> <br><span class="comment-separator">&rdsh;</span> <span class="bookmark-comment"><%= item.content %></span>
-                 </span>
-                 <span class="dash">&mdash;</span>
-                 <span class="meta">added <%= item.created_at.strftime('%l:%M%P on %d/%m/%y') if item.created_at.present? %></span>
-               <% end %>
-         </li>
-       <% end %>
+    <% @items.group_by { |item| item.respond_to?(:published_at) ? item.published_at.to_date : item.created_at.to_date }.each do |date, items| %>
+      <li class="date-heading">
+        From <%= date.strftime('%B %e, %Y') %>:
+      </li>
+      <% items.each do |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) %>
+              <abbr title="internal link">&swarr;&#xFE0E;</abbr>
+            </span>
+            <span class="dash">&mdash;</span>
+            <span class="meta">posted <%= item.published_at.strftime('%d/%m/%y') %>, tagged as <%= raw item.format_tags %></span>
+            <% 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" %>
+              <abbr title="external link">&nearr;&#xFE0E;</abbr> <br><span class="comment-separator">&rdsh;</span> <span class="bookmark-comment"><%= item.content %></span>
+            </span>
+            <span class="dash">&mdash;</span>
+            <span class="meta">added <%= item.created_at.strftime('%l:%M%P on %d/%m/%y') if item.created_at.present? %> <span class="lowlight"><%= link_to "❧", "/#{item.updated_at.year}/#{item.slug}", title: "permalink" %></a></span>
+          <% end %>
+        </li>
+      <% end %>
+    <% end %>
   </ul>
 </div>
 
index 44236aa49a508a47f64f89bae0b28e7074a33b1c..f71b8aab1b82080f064cc9f068b3ed62fe431d81 100644 (file)
@@ -5,11 +5,21 @@
   <% content_for :title, @post.title %>
   <% content_for :meta_description, "#{@post.generate_excerpt(150)}." %>
   <% content_for :meta_keywords, "#{@post.tags}" %>
+  <% if @post.post_type != "bookmark" %>
   <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 %> <% if [email protected]_dispatch?%>Reading Time: about <%= @reading_time %> minute(s).<% end %></p>
   </div>
+  <% else %>
+  <h1 style="margin-bottom: -.8em">Bookmark comment permalink:</h1>
+  <h3><%= @post.title %></h3>
+  <%= link_to "View original content", @post.url, class: "button" %>
+  <%= link_to "More from mind reader", "#{root_path}?filter=bookmarks", class: "button", target: "_BLANK" %>
+  <div class="postmeta">
+       <p>Originally bookmarked on mind reader on <%= @post.published_at.strftime('%B %d, %Y') %>.</p>
+  </div>
+  <% end %>
 </div>
 
 <div class="post">
@@ -21,6 +31,8 @@
   </div>
 </div>
 
+<% if @post.post_type != "bookmark" %>
 <div class="container" id="bottom">
   <%= render partial: "layouts/home_post_links" %>
 </div>
+<% end %>