<p>Dear <%= @user.first_name %>,</p>
-
<p>Here's what's new from mind reader this week:</p>
-
<% @bookmarks.group_by { |bookmark| bookmark.created_at.to_date }.each do |date, bookmarks| %>
- <p>On <%= date.strftime('%B %e, %Y') %>:</p>
-
+ <p span="dateline">On <%= date.strftime('%B %e, %Y') %>:</p>
<ul>
<% bookmarks.each do |bookmark| %>
<li>
- <% if bookmark.url.present? %>
- <strong><a href="<%= bookmark.url %>" target="_blank"><%= bookmark.title %></a></strong>
- <% else %>
- <strong><%= bookmark.title %></strong>
- <% end %>
+ <% url = if bookmark&.url&.present?
+ bookmark.url
+ else
+ year = bookmark&.created_at&.year || "2000"
+ "https://mndrdr.org/#{year}/#{bookmark.slug}"
+ end %>
+ <strong><a href="<%= url %>" target="_blank"><%= bookmark.title %></a></strong>
<% if bookmark.content.present? %>
- <br><em><%= bookmark.content %></em>
+ <br><em><%= truncate(bookmark.content, length: 255, separator: ' ', omission: '...') %></em>
<% end %>
<% if bookmark.created_at.present? %>
<br><small>Added at <%= bookmark.created_at.strftime('%l:%M%P') %></small>
<% end %>
</ul>
<% end %>
-
<p>Have a great weekend,<br>
Aidan.</p>
+<style type="text/css">
+<!--
+ li { margin-bottom: 3px; }
+ .dateline:first-of-type { margin-top: 0 }
+ .dateline { margin-top: 5px; }
+-->
+</style>