Skip to content

Commit 8419d21

Browse files
committed
Preview line for each message
1 parent 1e2d632 commit 8419d21

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

app/decorators/message_decorator.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ module MessageDecorator
44
def from
55
super&.gsub(/@[a-zA-Z.\-]+/, '@...')
66
end
7+
8+
def first_line
9+
body.lines.first&.strip
10+
end
711
end

app/views/messages/_thread.html.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<%= link_to without_list_prefix(message.subject), "/#{list.name}/#{message.list_seq}", data: {turbo_frame: 'message_content'} %>
1515
<span class="text-sm text-gray-500 dark:text-gray-400 font-normal ml-2"><%= message.from %></span>
1616
</h2>
17+
<% if message.body.present? %>
18+
<p class="text-sm text-gray-600 dark:text-gray-400 mb-2 line-clamp-1"><%= message.first_line %></p>
19+
<% end %>
1720
<div class="flex items-center gap-3 text-sm text-gray-600 dark:text-gray-400">
1821
<span class="inline-flex items-center gap-1">
1922
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -37,6 +40,9 @@
3740
<span class="px-0.5">[#<%= message.list_seq %>] <%= without_list_prefix(message.subject) %></span>
3841
<% end %>
3942
<span class="text-gray-500 dark:text-gray-400"><%= message.from %></span>
43+
<% if message.body.present? %>
44+
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1 line-clamp-1"><%= message.first_line %></p>
45+
<% end %>
4046
</div>
4147
</div>
4248
</div>

0 commit comments

Comments
 (0)