summaryrefslogtreecommitdiff
blob: fa58a63b830002750e7d5ee7d3aa94d591a6739a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<h1 class="first-header">Gentoo Archives: <%= list %></h1>

<div class="table-responsive">
  <table class="table table-sm ag-header-table">
    <tr>
      <th class="ag-header-name-col">From:</th>
      <td><%= h strip_email_headers(message['_source']['from']).first %></td>
    </tr>
    <tr>
      <th>To:</th>
      <td><%= h strip_email_headers(message['_source']['to']).join ', ' %></td>
    </tr>
    <% unless message['_source']['cc'] == nil or message['_source']['cc'] == [] %>
    <tr>
      <th>Cc:</th>
      <td><%= h strip_email_headers(message['_source']['cc']).join ', ' %></td>
    </tr>
    <% end %>
    <tr>
      <th>Subject:</th>
      <td><strong><%= h message['_source']['subject'] %></strong></td>
    </tr>
    <tr>
      <th>Date:</th>
      <td><%= date_format message['_source']['date'] %></td>
    </tr>
    <tr>
      <th>Message-Id:</th>
      <td><tt><%= h message['_source']['raw_message_id'] %></tt></td>
    </tr>
    <% unless parent == nil %>
    <tr>
      <th>In Reply to:</th>
      <td colspan="3"><a href="<%= parent['_id'] %>"><%= parent['_source']['subject'] %></a> by <%= parent['_source']['from'] %></td>
    </tr>
    <% end %>
  </table>
</div>

<pre class="ag-message-content"><div class="d-flex flex-row"><div class="text-right pr-3"><% strip_email(message['_source']['content']).split("\n").each_with_index do |line, index| %><a id="L<%= index + 1 %>" class="ag-line-number" href="#L<%= index + 1 %>"><%= index + 1 %></a><br/><% end %></div><div id="ag-message-body" class="w-100"><%= linkize(strip_email(message['_source']['content'])) %></div></div></pre>

<% if message['_source']['attachments'] and not message['_source']['attachments'].empty? %>
<h3>Attachments</h3>

<div class="table-responsive">
  <table class="table table-sm ag-attachment-table">
    <tr>
      <th>File name</th>
      <th>MIME type</th>
    </tr>
    <% message['_source']['attachments'].each do |attachment| %>
      <tr>
        <td><%= h attachment['filename'] %></td>
        <td><%= h attachment['mime'] %></td>
      </tr>
    <% end %>
  </table>
</div>
<% end %>

<% unless children == nil %>
<h3>Replies</h3>

<div class="table-responsive">
  <table class="table table-sm ag-replies-table">
    <tr>
      <th>Subject</th>
      <th>Author</th>
    </tr>
    <% children.each do |child| %>
      <tr>
        <td><a href="<%= child['_id'] %>"><%= h child['_source']['subject'] %></a></td>
        <td><%= h strip_email_headers(child['_source']['from']).first %></td>
      </tr>
    <% end %>
  </table>
</div>
<% end %>

<div class="ag-message-actions">
  <a href="/<%= h list %>/report/<%= message['_id'] %>" class="btn btn-danger btn-sm"><span class="fa fa-fw fa-ban"></span> Report Message</a>
  <div class="btn-group btn-group-sm ml-3">
    <a href="<%= msgid_to_marc(message['_source']['raw_message_id']) %>" class="btn btn-outline-secondary"><span class="fa fa-fw fa-share-square"></span>Find on MARC</a>
    <a href="<%= msgid_to_googlegroup(message['_source']['raw_message_id']) %>" class="btn btn-outline-secondary"><span class="fa fa-fw fa-share-square"></span>Find on Google Groups</a>
  </div>
</div>

<script>
    var lineNumber = window.location.hash.substr(1).replace("L", "");

    if(!isNaN(parseFloat(lineNumber)) && isFinite(lineNumber)){
        var lines = document.getElementById("ag-message-body").innerHTML.split("\n");
        lines[parseFloat(lineNumber) - 1] = '<div style="display: inline-block;background-color:#FFF3CD;">' + lines[parseFloat(lineNumber) - 1] + '</div>'
        document.getElementById("ag-message-body").innerHTML = lines.join("\n");
    }
</script>