From 4bf91463052c41965ee7a9f79ab2187ea65d3d82 Mon Sep 17 00:00:00 2001 From: Max Magorsch Date: Sat, 11 Jul 2020 15:12:51 +0200 Subject: Use a table for the message body instead of pre This simplifies the highlighting of lines. Signed-off-by: Max Magorsch --- public/css/main.css | 4 ++++ views/message.erb | 33 +++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/public/css/main.css b/public/css/main.css index 0acabf6..aa81004 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -100,6 +100,10 @@ .ag-date { } +.ag-line:target { + background-color:#FFF3CD; +} + .ag-line-number{ color: #c1c1c1!important; } diff --git a/views/message.erb b/views/message.erb index 40c333a..f7e1c89 100644 --- a/views/message.erb +++ b/views/message.erb @@ -37,7 +37,30 @@ -
<% strip_email(message['_source']['content']).split("\n").each_with_index do |line, index| %><%= index + 1 %>
<% end %>
<%= linkize(strip_email(message['_source']['content'])) %>
+
+ + <% inquote = false %> + <% linkize(strip_email(message['_source']['content'])).split("\n").each_with_index do |line, index| %> + + + <% if line.start_with?('
') %> + <% inquote = true %> +
+ <% elsif line.end_with?('') %> + <% inquote = false %> + + <% else %> + <% if inquote %> + + <% else %> + + <% end %> + <% end %> + + <% end %> +
<%= index + 1 %><%= line.sub('
','') %>
<%= line.sub('','') %><%= line %><%= line %>
+
+ <% if message['_source']['attachments'] and not message['_source']['attachments'].empty? %>

Attachments

@@ -86,10 +109,6 @@