.gitignore expanded, Votingsite expanded
.gitignore:
- All logs are now going to be ignored by git
VotingController.java:
- added the categoryRepository to the model
voting.html:
- showing data out of categoryRepository now
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -31,4 +31,6 @@ build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
*.log
|
||||
|
||||
### Logging ###
|
||||
/logs/
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user