-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.erb
72 lines (69 loc) · 2.58 KB
/
template.erb
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
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.4/css/jquery.dataTables.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.js"></script>
<title></title>
</head>
<body>
<% tableid = 0 %>
<% documents.each do |doc| %>
<h1>Comments on <%= doc[:id] %> - <%= doc[:title] %></h1>
<% tableid += 1 %>
Click column headings to sort
<table id="table<%= tableid %>" class="display">
<thead>
<tr>
<th>ID</th>
<th>Type</th>
<th>Name</th>
<th>Files</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<% doc[:comments].each do |c| %>
<tr>
<td><%= c[:id].sub(/.*-(.+)/, '\1') %>
<td>
<% if (c[:lastname] || c[:firstName]) %>
Type_Person
<% elsif (c[:organization]) %>
Type_Org
<% else %>
Type_Unknown
<% end %>
</td>
<td>
<% if (c[:lastName] || c[:firstName]) %>
<%= c[:lastName] %>, <%= c[:firstName] %>
<% end %>
<% if (c[:organization]) %>
<%= c[:organization] %>
<% end %>
<% if (c[:city] || c[:state] || c[:country]) %>
from <%= c[:city] %>, <%= c[:state] %>, <%= c[:country] %>
<% end %>
</td>
<td>
<% c[:attachments]&.each do |attachment| %>
<%= attachment[:title] %>
<% attachment[:urls].each do |url| %>
<a href="<%=url%>">[<%= File.extname(url) %>]</a>
<% end %>
<br />
<% end %>
</td>
<td><%= c[:comment] %></td>
</tr>
<% end %>
</tbody>
</table>
<script type="text/javascript">
let table = new DataTable('#table<%= tableid %>', {
"paging": false
});
</script>
<% end %>
</body>
</html>