PossibleCandidates get saved to their own database now

CHANGED VotingController:
    - changed 'candidateSaving' possibleCandidates get Located by name and category and get saved now

CHANGED PossibleCandidateRepository:
    - removed 'findByNameAndCategoryID'
    - added 'findByNameAndCategory'

ADDED addingCandidates.css:
    - added basic styling

CHANGED voting.css:
    - bug that div gets cut off resolved

CHANGED addingCandidates.html:
    - changed display method from table to div

CHANGED: voting.html:
    - added div to style the site (bugfix)
This commit is contained in:
2020-12-02 14:08:28 +01:00
parent 0b138d647d
commit 56d3f9875c
6 changed files with 101 additions and 37 deletions
@@ -4,29 +4,20 @@
<head>
<meta charset="UTF-8">
<title>Title</title>
<link th:href="@{/styles/addingCandidates.css}" rel="stylesheet" />
</head>
<body>
<h1>Schlage für jede Kategorie eine/n Kandiadt/en vor:</h1>
<form action="#" th:action="@{/saveCandidates}" th:object="${form}" method="post">
<fieldset>
<table>
<thead>
<tr>
<th> Kategorie</th>
<th> Kandidat/in</th>
</tr>
</thead>
<tbody>
<tr th:each="category, itemStat : ${categories}">
<td th:text="${category.name}"></td>
<td><input th:field="*{possibleCandidates[__${itemStat.index}__].name}" /></td>
</tr>
</tbody>
</table>
<body class="center-screen">
<div class="centered">
<h1>Schlage für jede Kategorie eine/n Kandiadt/en vor:</h1>
<form action="#" th:action="@{/saveCandidates}" th:object="${form}" method="post">
<div th:each="category, itemStat : ${categories}">
<h2 class="categoryHeader" th:text="${category.name}"></h2>
<input th:field="*{possibleCandidates[__${itemStat.index}__].name}" />
</div>
<input type="submit" id="submitButton" th:value="Confirm"></button>
</fieldset>
</form>
</form>
</div>
</body>
</html>
+12 -12
View File
@@ -44,20 +44,20 @@
input.value = voteIds;
}
</script>
<h1>Wähle deine Kandidaten:</h1>
<div th:each="category,iter : ${categories}">
<h2 class="categoryHeader" th:text="${category.name}"></h2>
<div th:each="candidate : ${category.candidateList}" class="voteDiv">
<button class="inputButton" th:id="|category${category.id}_candidate${candidate.id}|" th:text="${candidate.name}" th:onclick="|setColor(category${category.id}_candidate${candidate.id})|"></button>
<div class="centered">
<h1>Wähle deine Kandidaten:</h1>
<div th:each="category,iter : ${categories}">
<h2 class="categoryHeader" th:text="${category.name}"></h2>
<div th:each="candidate : ${category.candidateList}" class="voteDiv">
<button class="inputButton" th:id="|category${category.id}_candidate${candidate.id}|" th:text="${candidate.name}" th:onclick="|setColor(category${category.id}_candidate${candidate.id})|"></button>
</div>
</div>
<form action="#" th:action="@{/processVote}" method="post">
<input id="voteValues" type="hidden" name="voteValues" value="" />
<input id="voterName" type="hidden" name="voterEmail" th:value="${name}" />
<button type="submit" id="submitButton" onclick="getVotes()">Auswahl bestätigen</button>
</form>
</div>
<form action="#" th:action="@{/processVote}" method="post">
<input id="voteValues" type="hidden" name="voteValues" value="" />
<input id="voterName" type="hidden" name="voterEmail" th:value="${name}" />
<button type="submit" id="submitButton" onclick="getVotes()">Auswahl bestätigen</button>
</form>
</body>
</html>