-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.liquid
135 lines (123 loc) · 4.74 KB
/
table.liquid
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE html>
<html lang="en">
{% capture baseRoot %}{% relativeUrl "/" %}{% endcapture %}
<head>
{% comment %}
This is used to set up DataTables
{% endcomment %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<link
rel="stylesheet"
type="text/css"
href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.css">
<script>
$(document).ready(function() {
$('#table').DataTable({
stateSave: true,
scrollY: '70vh',
scrollCollapse: true,
scrollX: true,
"lengthMenu": [
[
50, 100, 200, -1
],
[
50, 100, 200, 'All'
]
]
});
});
</script>
{% comment %}
DataTables setup done
{% endcomment %}
<link rel="stylesheet" href= {{ baseRoot | append: "/css/table.css" }}>
<link rel="stylesheet" href={{baseRoot | append: "/css/header.css"}}>
<link rel="stylesheet" href={{baseRoot | append: "/css/footer.css"}}>
<meta charset="utf-8">
<title>Orphan Train Passengers</title>
</head>
<body>
{% render 'header', urlRoot:baseRoot %}
<div class="pageBody">
<h1>Passengers on the Orphan Train</h1>
{% comment %}
add the id so DataTables knows what's going on.
Class is how you select your styles
{% endcomment %}
<table
id="table"
class="display compact"
style="width:100%">
<thead>
<tr>
<th>Birth Name</th>
<th>Birth Name Alt</th>
<th>Age on Arrival</th>
<th>Sending Organization</th>
<th>Foster Name</th>
<th>Foster Name Alt</th>
<th>Married Name</th>
<th>Married Name Alt</th>
<th>Spouse Name</th>
<th>Spouse Name Alt</th>
<th>Arrival Date</th>
<th>Arrival Place</th>
<th>Family Taking Child</th>
<th>Family Taking Child Alt</th>
<th>Location of Family</th>
<th>Date of Birth</th>
<th>Place of Birth</th>
</tr>
</thead>
<tbody>
{% for record in Orphan_Train_Data %}
<tr>
<td>
{% comment %} This is already a working relative link, no need to change anything {% endcomment %}
<a href="../people/{{record.AutoID}}/index.html">
{% unless record["Birth Name First"] == empty and record["Birth Name Middle"] == empty and record["Birth Name Last"] == empty %}
{{ record["Birth Name First"] }} {{ record["Birth Name Middle"] }} {{ record["Birth Name Last"] }}
{% else %}
Link to Page
{% endunless %}
</a>
</td>
<td>{{ record["Birth Name Alt"] }}</td>
{% comment %}
following logic is for proper sorting
{% endcomment %}
{% capture ageString %}
{{record["Age on Arrival in Years"]}}
{% endcapture %}
{% capture actualAge %}
{% correctAge ageString %}
{% endcapture %}
<td data-order={{actualAge}}>{{ record["Age on Arrival in Years"] }}</td>
<td>{{ record["Sending Organization"] }}</td>
<td>{{ record["Adopted Name First"] }} {{ record["Adopted Name Middle"] }} {{ record["Adopted Name Last"] }}</td>
<td>{{ record["Adopted Name Alt"] }}</td>
<td>{{ record["Married Name First"] }} {{ record["Married Name Middle"] }} {{ record["Married Name Last"] }}</td>
<td>{{ record["Married Name Alt"] }}</td>
<td>{{ record["Spouse Name First"] }} {{ record["Spouse Name Middle"] }} {{ record["Spouse Name Last"] }}</td>
<td>{{ record["Spouse Name Alt"] }}</td>
<td>{{ record["Arrival Date"] }}</td>
<td>{{ record["Arrival Place"] }}</td>
<td>{{ record["Family Taking Child First"] }} {{ record["Family Taking Child Middle"] }} {{ record["Family Taking Child Last"] }}</td>
<td>{{ record["Family Taking Child Alt"] }}</td>
<td>{{ record["Location of Family"] }}</td>
<td>{{ record["Date of Birth"] }}</td>
<td>{{ record["Place of Birth"] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<a
download
href= {{ baseRoot | append: "/_data/Orphan_Train_Data.csv" }}
class="downloadButton">Download CSV</a>
</div>
{% render 'footer', urlRoot:baseRoot %}
</body>
</html>