Compare commits
No commits in common. "026f0c9d2a2654b06b7767bf091333dd68873cc0" and "dcd480b043bd0068193b301f4e5965b647de35a7" have entirely different histories.
026f0c9d2a
...
dcd480b043
6 changed files with 7 additions and 15 deletions
|
|
@ -2,6 +2,6 @@ function login() {
|
||||||
const usernameInput = document.getElementById('username');
|
const usernameInput = document.getElementById('username');
|
||||||
const passwordInput = document.getElementById('password');
|
const passwordInput = document.getElementById('password');
|
||||||
|
|
||||||
const credentials = `${usernameInput.value}:${passwordInput.value}`;
|
const token = btoa(`${usernameInput.value}:${passwordInput.value}`);
|
||||||
document.cookie = `credentials=${credentials}; path=/`;
|
document.cookie = `token=${String(token)}; path=/`;
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ function createNewMember(id) {
|
||||||
childInput.type = "checkbox";
|
childInput.type = "checkbox";
|
||||||
childInput.id = `child-${id}`;
|
childInput.id = `child-${id}`;
|
||||||
childInput.name = `child-${id}`;
|
childInput.name = `child-${id}`;
|
||||||
childInput.style = "font-size: 1rem";
|
childInput.style = 'font-size: 1rem';
|
||||||
|
|
||||||
const childInputDiv = document.createElement("div");
|
const childInputDiv = document.createElement("div");
|
||||||
childInputDiv.classList.add("fill-right");
|
childInputDiv.classList.add("fill-right");
|
||||||
|
|
@ -40,18 +40,15 @@ function createNewMember(id) {
|
||||||
childDiv.appendChild(childLabel);
|
childDiv.appendChild(childLabel);
|
||||||
childDiv.appendChild(childInputDiv);
|
childDiv.appendChild(childInputDiv);
|
||||||
|
|
||||||
const dietDiv = document.createElement("div");
|
const dietDiv = document.createElement("p");
|
||||||
dietDiv.style = "flex-direction: column;";
|
|
||||||
|
|
||||||
const dietLabel = document.createElement("label");
|
const dietLabel = document.createElement("label");
|
||||||
dietLabel.htmlFor = `diet-${id}`;
|
dietLabel.htmlFor = `diet-${id}`;
|
||||||
dietLabel.innerHTML = "Dietary preferences:";
|
dietLabel.innerHTML = "Dietary preferences:";
|
||||||
dietLabel.style = "flex:1;";
|
|
||||||
|
|
||||||
const dietInput = document.createElement("textarea");
|
const dietInput = document.createElement("textarea");
|
||||||
dietInput.id = `diet-${id}`;
|
dietInput.id = `diet-${id}`;
|
||||||
dietInput.name = `dietaryPreferences-${id}`;
|
dietInput.name = `dietaryPreferences-${id}`;
|
||||||
dietInput.style = "flex:1;"
|
|
||||||
|
|
||||||
dietDiv.appendChild(dietLabel);
|
dietDiv.appendChild(dietLabel);
|
||||||
dietDiv.appendChild(dietInput);
|
dietDiv.appendChild(dietInput);
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@
|
||||||
<body>
|
<body>
|
||||||
<h1 class="title fontXL textCenter backgroundLightGreen colorWhite">Collin and Lucy's Wedding</h1>
|
<h1 class="title fontXL textCenter backgroundLightGreen colorWhite">Collin and Lucy's Wedding</h1>
|
||||||
<div class="contents">
|
<div class="contents">
|
||||||
<table id="rsvpsTable">
|
|
||||||
<tbody></tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
<script src="/rsvps_list.js"></script>
|
<script src="/rsvps_list.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ function createRsvpEntry(rsvp) {
|
||||||
const newRow = document.createElement('tr');
|
const newRow = document.createElement('tr');
|
||||||
|
|
||||||
const attendingColumn = document.createElement('td');
|
const attendingColumn = document.createElement('td');
|
||||||
attendingColumn.innerText = attending ? '\u2705' : '\u274C';
|
attendingColumn.innerText = attending ? '✅' : '❌';
|
||||||
|
|
||||||
const nameColumn = document.createElement('td');
|
const nameColumn = document.createElement('td');
|
||||||
nameColumn.innerText = member.name;
|
nameColumn.innerText = member.name;
|
||||||
|
|
||||||
const childColumn = document.createElement('td');
|
const childColumn = document.createElement('td');
|
||||||
childColumn.innerText = member.child ? '\u{1F476}' : '\u{1F474}';
|
childColumn.innerText = member.child ? '👶' : '🧓';
|
||||||
|
|
||||||
const dietaryPreferencesColumn = document.createElement('td');
|
const dietaryPreferencesColumn = document.createElement('td');
|
||||||
dietaryPreferencesColumn.innerText = member.dietaryPreferences.length > 0 ? member.dietaryPreferences : 'n/a';
|
dietaryPreferencesColumn.innerText = member.dietaryPreferences.length > 0 ? member.dietaryPreferences : 'n/a';
|
||||||
|
|
@ -32,7 +32,7 @@ async function getRsvps() {
|
||||||
const token = Object.fromEntries(
|
const token = Object.fromEntries(
|
||||||
document.cookie.split(";").map((x) => x.trim().split("="))
|
document.cookie.split(";").map((x) => x.trim().split("="))
|
||||||
)['token']
|
)['token']
|
||||||
const resp = await fetch('/api/rsvps', { headers: { 'Authorization': `Basic ${String(btoa(token))}`} });
|
const resp = await fetch('/api/rsvps', { headers: { 'Authorization': `Basic ${token}`} });
|
||||||
const rsvps = await resp.json()
|
const rsvps = await resp.json()
|
||||||
for (const rsvp of rsvps) {
|
for (const rsvp of rsvps) {
|
||||||
createRsvpEntry(rsvp);
|
createRsvpEntry(rsvp);
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,6 @@ form#rsvps div.members div.member {
|
||||||
form#rsvps div.members div.member div {
|
form#rsvps div.members div.member div {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
form#rsvps div.members div.member div.separator {
|
form#rsvps div.members div.member div.separator {
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ func (h *Handler) getRsvps(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Add("Content-Type", "application/json")
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
fmt.Fprintf(w, "%s", marshalledRsvps)
|
fmt.Fprintf(w, "%s", marshalledRsvps)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue