Merge branch 'backend' into main

This commit is contained in:
2020-11-14 15:07:52 +01:00
3 changed files with 10 additions and 1 deletions

4
.gitignore vendored
View File

@@ -31,4 +31,6 @@ build/
### VS Code ###
.vscode/
*.log
### Logging ###
/logs/

View File

@@ -1,6 +1,7 @@
package com.github.cato447.AbizeitungVotingSystem.controller;
import com.github.cato447.AbizeitungVotingSystem.entities.Candidate;
import com.github.cato447.AbizeitungVotingSystem.entities.Category;
import com.github.cato447.AbizeitungVotingSystem.entities.Voter;
import com.github.cato447.AbizeitungVotingSystem.repositories.CandidateRepository;
import com.github.cato447.AbizeitungVotingSystem.repositories.CategoryRepository;
@@ -76,7 +77,9 @@ public class VotingController {
return "errors/alreadyVoted.html";
} else {
List<Candidate> candidates = candidateRepository.findAll();
List<Category> categories = categoryRepository.findAll();
model.addAttribute("candidates", candidates);
model.addAttribute("categories", categories);
LOGGER.info(name + " is voting now");
return "voting.html";
}

View File

@@ -10,6 +10,10 @@
<body>
<h1>Wähle deine Kandidaten:</h1>
<div th:each="category,iter : ${categories}">
<h2 th:text="${category.candidateList[iter.index]}"></h2>
</div>
<div th:each="candidate : ${candidates}" class="candidates">
<h2 th:text="${candidate.category.name}"></h2>
<ul>