Skip to content

Commit c3f2bab

Browse files
committed
Added form submission page
1 parent bef48ab commit c3f2bab

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

_assets/css/main.css

+35
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,41 @@ table#professional-experience tr + tr td {
190190
padding-top: 0.75rem;
191191
}
192192

193+
/* spinner used while waiting for fetch, see https://loading.io/css/ */
194+
195+
.loading-spinner {
196+
color: #961c1c;
197+
}
198+
.lds-dual-ring,
199+
.lds-dual-ring:after {
200+
box-sizing: border-box;
201+
}
202+
.lds-dual-ring {
203+
display: inline-block;
204+
width: 80px;
205+
height: 80px;
206+
}
207+
.lds-dual-ring:after {
208+
content: " ";
209+
display: block;
210+
width: 64px;
211+
height: 64px;
212+
margin: 8px;
213+
border-radius: 50%;
214+
border: 6.4px solid currentColor;
215+
border-color: currentColor transparent currentColor transparent;
216+
animation: lds-dual-ring 1.2s linear infinite;
217+
}
218+
@keyframes lds-dual-ring {
219+
0% {
220+
transform: rotate(0deg);
221+
}
222+
100% {
223+
transform: rotate(360deg);
224+
}
225+
}
226+
227+
193228
/* footer */
194229

195230
#main {

secure/form-submissions.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
layout: default
3+
title: Form Submissions
4+
---
5+
6+
This table shows form submissions over the last 30 days:
7+
<div id="form-submissions"><div class="lds-dual-ring"></div></div>
8+
9+
<script>
10+
fetch("/secure/api/form", {
11+
method: "GET",
12+
headers: {
13+
"accept": "application/json",
14+
"content-type": "application/json",
15+
},
16+
})
17+
.then(res => res.json())
18+
.then(submissions => {
19+
const table = document.createElement("table");
20+
submissions.forEach(row => {
21+
const tr = table.insertRow();
22+
const td = tr.insertCell();
23+
td.innerHTML = row.submission_id;
24+
});
25+
document.getElementById("form-submissions").innerHTML = table;
26+
});
27+
</script>

secure/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ layout: default
33
title: "Secure area: index"
44
---
55

6+
- [(Contact) form submissions](form-submissions)
67
- [Token generator (for urgent contact form)](token-generator)

0 commit comments

Comments
 (0)