Add index page and link to share more easily

This commit is contained in:
2025-01-20 10:13:59 +01:00
parent 5668b1cd6a
commit bddae031cc
5 changed files with 53 additions and 6 deletions

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create New Election</title>
<title>Create New Election - qv</title>
<script src="/static/js/tailwind.min.js"></script>
<script src="/static/js/alpine.min.js" defer></script>
</head>
@ -90,10 +90,17 @@
</ul>
</div>
<template x-if="createdElectionId > 0">
<template x-if="createdElectionId != ''">
<div class="mt-6 bg-green-100 p-4 rounded-md">
<h2 class="text-green-700 font-bold">Election Created Successfully</h2>
<p class="mt-2">Election ID: <span class="font-mono" x-text="createdElectionId"></span></p> <!-- TODO: link to created election -->
<p class="mt-2">
<a
:href="`/election/${createdElectionId}`"
class="text-blue-600 underline hover:text-blue-800"
target="_blank">
View Election
</a>
</p>
</div>
</template>
@ -132,7 +139,7 @@
expiresAt: "",
choices: ["", ""]
},
createdElectionId: 0,
createdElectionId: "",
errorMessage: "",
errorDetails: {},
voterIdentities: [],
@ -148,7 +155,7 @@
async createElection() {
this.errorMessage = "";
this.errorDetails = {};
this.createdElectionId = 0;
this.createdElectionId = "";
this.voterIdentities = [];
const payload = {