Added candidate suggestion
- CHANGES: VotingControler:
-- added: switch to toogle between candidate suggestion and voting
-- added: suport for adding candidate names
-- added: method to save given candidate names
- ADDED: addingCandidates:
-- added: site to enter candidate suggestions
- ADDED: CandidateWrapper:
-- added: complete class to help with data transferation through th:object
- CHANGES: Category:
-- added: constructor with name parameter for logging purposes
- CHANGES: Candidate:
-- added: setters for class variables
- CHANGES: TableAction:
-- refactoring: moved method to vote and update vote status from VotingController to TableActions class
- CHANGES: Resources:
-- added: Files with data to feed to the tables
- ADDED: voteSuccessful:
-- added fallback html page
- REFACTORING: candidateAddingSuccessful:
-- renamed file
This commit is contained in:
@@ -3,16 +3,17 @@ 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.helper.CandidateWrapper;
|
||||
import com.github.cato447.AbizeitungVotingSystem.repositories.CandidateRepository;
|
||||
import com.github.cato447.AbizeitungVotingSystem.repositories.CategoryRepository;
|
||||
import com.github.cato447.AbizeitungVotingSystem.repositories.VoterRepository;
|
||||
import com.github.cato447.AbizeitungVotingSystem.table.TableAction;
|
||||
import org.apache.juli.logging.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.mail.SimpleMailMessage;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@@ -21,12 +22,15 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
public class VotingController {
|
||||
|
||||
private Boolean candidatesAdded = false;
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(VotingController.class);
|
||||
|
||||
private TableAction tableAction = new TableAction();
|
||||
@@ -45,18 +49,28 @@ public class VotingController {
|
||||
@Autowired
|
||||
JavaMailSender emailSender;
|
||||
|
||||
@RequestMapping("/")
|
||||
public String WelcomeSite() {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
LOGGER.info("setups");
|
||||
if (voterRepository.findAll().size() == 0) {
|
||||
tableAction.setUpVoters(voterRepository);
|
||||
LOGGER.info("Voters successfully set up");
|
||||
}
|
||||
|
||||
if (categoryRepository.findAll().size() == 0){
|
||||
tableAction.setUpCategories(categoryRepository);
|
||||
LOGGER.info("Categories successfully set up");
|
||||
}
|
||||
|
||||
if (candidateRepository.findAll().size() == 0) {
|
||||
tableAction.setUpCandidates(candidateRepository);
|
||||
LOGGER.info("Candidates successfully set up");
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/")
|
||||
public String WelcomeSite() {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
|
||||
.getRequest();
|
||||
|
||||
@@ -65,11 +79,6 @@ public class VotingController {
|
||||
LOGGER.info("User IP: " + request.getRemoteAddr());
|
||||
ipAddresses.add(currentIpAddress);
|
||||
}
|
||||
|
||||
tableAction.logVoters(voterRepository);
|
||||
tableAction.logCandidates(candidateRepository);
|
||||
tableAction.logCategories(categoryRepository);
|
||||
|
||||
return "start.html";
|
||||
}
|
||||
|
||||
@@ -91,14 +100,26 @@ public class VotingController {
|
||||
LOGGER.warn(name + " has already voted");
|
||||
return "errors/alreadyVoted.html";
|
||||
} else {
|
||||
List<Candidate> candidates = candidateRepository.findAll();
|
||||
List<Category> categories = categoryRepository.findAll();
|
||||
model.addAttribute("candidates", candidates);
|
||||
model.addAttribute("categories", categories);
|
||||
model.addAttribute("name", name);
|
||||
//sendSimpleMessage(name,"test", "test");
|
||||
LOGGER.info(name + " is voting now");
|
||||
return "voting.html";
|
||||
if(candidatesAdded) {
|
||||
List<Category> categories = categoryRepository.findAll();
|
||||
model.addAttribute("categories", categories);
|
||||
model.addAttribute("name", name);
|
||||
//sendSimpleMessage(name,"test", "test");
|
||||
LOGGER.info(name + " is voting now");
|
||||
return "voting.html";
|
||||
} else {
|
||||
CandidateWrapper candidates = new CandidateWrapper();
|
||||
List<Category> categories = categoryRepository.findAll();
|
||||
|
||||
for (int i = 0; i < categories.size(); i++){
|
||||
candidates.addCandidate(new Candidate());
|
||||
}
|
||||
|
||||
model.addAttribute("categories", categories);
|
||||
model.addAttribute("form", candidates);
|
||||
LOGGER.info(name + " is submitting candidates");
|
||||
return "addingCandidates.html";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(name + " is not allowed to vote");
|
||||
@@ -109,20 +130,21 @@ public class VotingController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/saveCandidates")
|
||||
public String candidateSaving(@ModelAttribute CandidateWrapper candidates){
|
||||
LOGGER.info(tableAction.logCandidates(candidates.getCandidates(), categoryRepository));
|
||||
return "candidateAddingSuccessful.html";
|
||||
}
|
||||
|
||||
@RequestMapping("/processVote")
|
||||
public String ProcessVote(@RequestParam String voteValues, @RequestParam String voterEmail) {
|
||||
String[] partVoteValues = voteValues.split(",");
|
||||
for (String s: partVoteValues) {
|
||||
long candidateID = Long.valueOf(s);
|
||||
Candidate candidate = candidateRepository.findById(candidateID).get();
|
||||
candidate.votedFor();
|
||||
candidateRepository.save(candidate);
|
||||
tableAction.voteFor(s, candidateRepository);
|
||||
}
|
||||
Voter voter = voterRepository.findByEmail(voterEmail);
|
||||
voter.vote();
|
||||
voterRepository.save(voter);
|
||||
tableAction.updateVotingStatus(voterEmail,voterRepository);
|
||||
LOGGER.info(voterEmail + " has voted!");
|
||||
return "success.html";
|
||||
return "voteSuccessful.html";
|
||||
}
|
||||
|
||||
@RequestMapping("/dashboard")
|
||||
|
||||
@@ -42,6 +42,18 @@ public class Candidate implements Comparable<Candidate>{
|
||||
|
||||
public Category getCategory() {return category;}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setVotes(Integer votes) {
|
||||
this.votes = votes;
|
||||
}
|
||||
|
||||
public void setCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public void votedFor() {
|
||||
this.votes += 1;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,11 @@ public class Category {
|
||||
this.candidateList = candidateList;
|
||||
}
|
||||
|
||||
public Category(String name){
|
||||
super();
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.github.cato447.AbizeitungVotingSystem.helper;
|
||||
|
||||
import com.github.cato447.AbizeitungVotingSystem.entities.Candidate;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
|
||||
public class CandidateWrapper {
|
||||
|
||||
private LinkedList<Candidate> candidates;
|
||||
|
||||
public CandidateWrapper(){
|
||||
candidates = new LinkedList<>();
|
||||
}
|
||||
|
||||
public void addCandidate(Candidate candidate){
|
||||
this.candidates.add(candidate);
|
||||
}
|
||||
|
||||
public LinkedList<Candidate> getCandidates() {
|
||||
return candidates;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.github.cato447.AbizeitungVotingSystem.table;
|
||||
|
||||
import com.github.cato447.AbizeitungVotingSystem.controller.VotingController;
|
||||
import com.github.cato447.AbizeitungVotingSystem.entities.Candidate;
|
||||
import com.github.cato447.AbizeitungVotingSystem.entities.Category;
|
||||
import com.github.cato447.AbizeitungVotingSystem.entities.Voter;
|
||||
@@ -22,6 +23,19 @@ public class TableAction {
|
||||
candidateRepository.save(candidate);
|
||||
}
|
||||
|
||||
public void updateVotingStatus(String email, VoterRepository voterRepository){
|
||||
Voter voter = voterRepository.findByEmail(email);
|
||||
voter.vote();
|
||||
voterRepository.save(voter);
|
||||
}
|
||||
|
||||
public void voteFor(String id, CandidateRepository candidateRepository){
|
||||
long candidateID = Long.valueOf(id);
|
||||
Candidate candidate = candidateRepository.findById(candidateID).get();
|
||||
candidate.votedFor();
|
||||
candidateRepository.save(candidate);
|
||||
}
|
||||
|
||||
public void setUpVoters(VoterRepository voterRepository){
|
||||
try {
|
||||
File emailFile = new File("src/main/resources/Q2_emails.txt");
|
||||
@@ -53,6 +67,25 @@ public class TableAction {
|
||||
candidateRepository.saveAll(candidates);
|
||||
}
|
||||
|
||||
public void setUpCategories(CategoryRepository categoryRepository){
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
try {
|
||||
File categoryFile = new File("src/main/resources/Categories.txt");
|
||||
Scanner myReader = new Scanner(categoryFile);
|
||||
ArrayList<Category> categories = new ArrayList<Category>();
|
||||
while (myReader.hasNextLine()) {
|
||||
String name = myReader.nextLine();
|
||||
Category category = new Category(name);
|
||||
categories.add(category);
|
||||
}
|
||||
categoryRepository.saveAll(categories);
|
||||
myReader.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("An error occurred.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String logCategories(CategoryRepository categoryRepository){
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
List<String> headers = Arrays.asList("Id", "Name", "Candidates");
|
||||
@@ -80,7 +113,7 @@ public class TableAction {
|
||||
|
||||
}
|
||||
|
||||
public String logCandidates(CandidateRepository candidateRepository){
|
||||
public String logCandidatesRepository(CandidateRepository candidateRepository){
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
List<String> headers = Arrays.asList("Id", "Name", "Votes");
|
||||
rows.add(headers);
|
||||
@@ -91,6 +124,20 @@ public class TableAction {
|
||||
return formatAsTable(rows);
|
||||
}
|
||||
|
||||
public String logCandidates(LinkedList<Candidate> candidates, CategoryRepository categoryRepository){
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
List<String> headers = Arrays.asList("Id", "Name", "Votes", "Category_ID");
|
||||
rows.add(headers);
|
||||
long i = 1;
|
||||
for (Candidate candidate: candidates) {
|
||||
Category category = categoryRepository.findById(i).get();
|
||||
rows.add(Arrays.asList("" + i, candidate.getName(), "" + 0, "" + category.getId()));
|
||||
i++;
|
||||
}
|
||||
|
||||
return formatAsTable(rows);
|
||||
}
|
||||
|
||||
private String formatAsTable(List<List<String>> rows) {
|
||||
int[] maxLengths = new int[rows.get(0).size()];
|
||||
for (List<String> row : rows)
|
||||
|
||||
46
src/main/resources/Categories.txt
Normal file
46
src/main/resources/Categories.txt
Normal file
@@ -0,0 +1,46 @@
|
||||
Wer wird nie von zuhause ausziehen?
|
||||
Wer bekommt die meisten Punkte in Flensburg (Wackel)
|
||||
Wer ist der/die kreativste Zuspätkommer/in
|
||||
Mit wem wird man am ehesten in der Zukunft angeben zur Schule gegangen zu sein?
|
||||
Wer wohnt im Fittnessstudio?
|
||||
Wer ist der Adonis/Afrodite der Stufe?
|
||||
Wer landet am ehesten im Bundestag (Wackel)
|
||||
Wer landet als erstes in der Ausnüchterungszelle?
|
||||
Wer ist der coolste Leherer?
|
||||
Wer ist die coolste Lehrerin?
|
||||
Wer macht den besten Matheunterricht?
|
||||
Welcher Lehrer hat den Beruf verfehlt?
|
||||
Welcher Lehrer ist nie da?
|
||||
Wer hat das Internet erfunden?
|
||||
Wer sponsort Schollin?
|
||||
Wer hat nur ein Outfit?
|
||||
Wer könnte Modeln?
|
||||
Wer ist am engagiertesten?
|
||||
Wer hat das größte Ego? (Wackel)
|
||||
Wer wird Bundeskanzler? (Lehrer und Schüler)
|
||||
Wer wird eine Sekte gründen?
|
||||
Wer saß am längsten im Klassenschrank?
|
||||
Wer hat die gößte Sauklaue (Leherer)?
|
||||
Wer hat die größte Sauklaue (Schüler)?
|
||||
Wer gründet das nächste Google?
|
||||
Wer kommt am schnellsten in den Knast?
|
||||
Top 3-Pärchen?
|
||||
Top 3 Lehrergespanne?
|
||||
Wer ist der motiviertester Lehrer?
|
||||
Wer ist Google auf zwei Beinen(Leherer)?
|
||||
Wer ist Google auf zwei Beinen(Schüler)?
|
||||
Wer hat den besten Style (Mädchen)?
|
||||
Wer hat den besten Style (Jungs)?
|
||||
Wer währe ein gutes Pärchen (Lehrer)?
|
||||
Wer währe ein gutes Pärchen (Schüler)?
|
||||
Wer trinkt am meisten Kaffe?
|
||||
Tischflip
|
||||
Wer wird Harzer?
|
||||
Wer hat Wiedererkennungswert?
|
||||
Wen erkennt man an der Lache?
|
||||
Wer bringt die dümmsten Witze?
|
||||
Wer hat den meisten Schwachsinn erzählt?
|
||||
Welche Lehrer machen nie das, was die Schüler wollten?
|
||||
Welcher Kurs hat am meisten Kuchen gegessen?
|
||||
Welcher Kurs hat am meisten Kaffee getrunken?
|
||||
Wer hat die meisten peinlichen Momente gebracht?
|
||||
156
src/main/resources/Q2_emails.txt
Normal file
156
src/main/resources/Q2_emails.txt
Normal file
@@ -0,0 +1,156 @@
|
||||
negar.barzegar@adolfinum.de
|
||||
simon.berger@adolfinum.de
|
||||
nicolas.cunha@adolfinum.de
|
||||
joline.hackstein@adolfinum.de
|
||||
philip.heckhoff@adolfinum.de
|
||||
simon.hormes@adolfinum.de
|
||||
benjamin.vogt@adolfinum.de
|
||||
taycan.arslan@adolfinum.de
|
||||
luca.boom@adolfinum.de
|
||||
leon.borgerding@adolfinum.de
|
||||
lukas.boy@adolfinum.de
|
||||
lukas.corell@adolfinum.de
|
||||
cedric.damerow@adolfinum.de
|
||||
amelie.david@adolfinum.de
|
||||
zeynep.efe@adolfinum.de
|
||||
melinda.hirschelmann@adolfinum.de
|
||||
lars.hogardt@adolfinum.de
|
||||
malin.kalnins@adolfinum.de
|
||||
victor.kocksnchez@adolfinum.de
|
||||
kamil.kowalczyk@adolfinum.de
|
||||
romyna.gurny@adolfinum.de
|
||||
noelia.kocksnchez@adolfinum.de
|
||||
lili.schweitzer@adolfinum.de
|
||||
jerome.laukamp@adolfinum.de
|
||||
elisa.bahl@adolfinum.de
|
||||
lisa.baumeister@adolfinum.de
|
||||
johanna.boeckmann@adolfinum.de
|
||||
svenja.fischer@adolfinum.de
|
||||
lena.goehlich@adolfinum.de
|
||||
paula.haub@adolfinum.de
|
||||
daria.horstmann@adolfinum.de
|
||||
melina.kascha@adolfinum.de
|
||||
pia.kleinwegen@adolfinum.de
|
||||
lauramarie.koenig@adolfinum.de
|
||||
yarkin.kulaksiz@adolfinum.de
|
||||
amelie.laake@adolfinum.de
|
||||
noemi.malaponti@adolfinum.de
|
||||
yara.mueser@adolfinum.de
|
||||
paul.nowack@adolfinum.de
|
||||
luca.ofiera@adolfinum.de
|
||||
timo.otto@adolfinum.de
|
||||
linnea.paulukuhn@adolfinum.de
|
||||
isabelle.schneider@adolfinum.de
|
||||
nico.scholzen@adolfinum.de
|
||||
manon.schroff@adolfinum.de
|
||||
carlotta.tueckmantel@adolfinum.de
|
||||
simon.bussmann@adolfinum.de
|
||||
luis.erpenbach@adolfinum.de
|
||||
meret.fass@adolfinum.de
|
||||
anna.feldmann@adolfinum.de
|
||||
alina.fuenderich@adolfinum.de
|
||||
joline.gilles@adolfinum.de
|
||||
karolina.hein@adolfinum.de
|
||||
robin.heldt@adolfinum.de
|
||||
annika.koch@adolfinum.de
|
||||
dusanka.djukanovic@adolfinum.de
|
||||
aaron.glos@adolfinum.de
|
||||
ayseguel.guelten@adolfinum.de
|
||||
hamza.hasoumi@adolfinum.de
|
||||
evelyn.hofmann@adolfinum.de
|
||||
burakmustafa.kulac@adolfinum.de
|
||||
dominik.kwitowski@adolfinum.de
|
||||
julia.lener@adolfinum.de
|
||||
paula.may@adolfinum.de
|
||||
luca.mueller@adolfinum.de
|
||||
mathieu.mueller@adolfinum.de
|
||||
marie.puetter@adolfinum.de
|
||||
hendrik.herffs@adolfinum.de
|
||||
greta.bentgens@adolfinum.de
|
||||
sven.mittmann@adolfinum.de
|
||||
jan.hoevel@adolfinum.de
|
||||
tim.krichel@adolfinum.de
|
||||
milo.lehnen@adolfinum.de
|
||||
lewis.lehner@adolfinum.de
|
||||
nico.lipinski@adolfinum.de
|
||||
luise.lu@adolfinum.de
|
||||
maike.nawarotzky@adolfinum.de
|
||||
rabea.peters@adolfinum.de
|
||||
patrick.preuss@adolfinum.de
|
||||
julius.preusser@adolfinum.de
|
||||
marie.scheidung@adolfinum.de
|
||||
lena.schlayer@adolfinum.de
|
||||
emma.sprenger@adolfinum.de
|
||||
klaudia.kapala@adolfinum.de
|
||||
gabriel.schacht@adolfinum.de
|
||||
delia.schmitz@adolfinum.de
|
||||
katharina.schmitz@adolfinum.de
|
||||
laurin.severith@adolfinum.de
|
||||
julian.sievers@adolfinum.de
|
||||
anna.siewert@adolfinum.de
|
||||
chiara.welter@adolfinum.de
|
||||
kira.winzen@adolfinum.de
|
||||
tim.zentzis@adolfinum.de
|
||||
justus.boesken@adolfinum.de
|
||||
finia.brinkmann@adolfinum.de
|
||||
anesa.cavcic@adolfinum.de
|
||||
antonia.eigemann@adolfinum.de
|
||||
nico.hahn@adolfinum.de
|
||||
timo.kohlmann@adolfinum.de
|
||||
alexander.kupillas@adolfinum.de
|
||||
alexander.neumann@adolfinum.de
|
||||
sophie.osterloh@adolfinum.de
|
||||
clemens.palinsky@adolfinum.de
|
||||
oliver.palinsky@adolfinum.de
|
||||
hendrik.pierlo@adolfinum.de
|
||||
lilly.schmidtke@adolfinum.de
|
||||
mara.spicker@adolfinum.de
|
||||
anhtrung.vo@adolfinum.de
|
||||
ben.schwarz@adolfinum.de
|
||||
luca.urbanczyk@adolfinum.de
|
||||
helena.neukirch@adolfinum.de
|
||||
nikita.lauff@adolfinum.de
|
||||
jennifer.lengard@adolfinum.de
|
||||
julia.mueller@adolfinum.de
|
||||
philipp.nothers@adolfinum.de
|
||||
judith.oppenberg@adolfinum.de
|
||||
dilan.oeztuerk@adolfinum.de
|
||||
malo.soulier@adolfinum.de
|
||||
mery.stern@adolfinum.de
|
||||
nouel.verberkt@adolfinum.de
|
||||
leon.viktora@adolfinum.de
|
||||
pia.anthes@adolfinum.de
|
||||
eray.arici@adolfinum.de
|
||||
christian.beutel@adolfinum.de
|
||||
mara.blanke@adolfinum.de
|
||||
lilly.ventzke@adolfinum.de
|
||||
luzi.weichert@adolfinum.de
|
||||
moritz.weihnacht@adolfinum.de
|
||||
leony.wittmann@adolfinum.de
|
||||
annika.lieblang@adolfinum.de
|
||||
leonie.wallusch@adolfinum.de
|
||||
felix.kirsten@adolfinum.de
|
||||
moritz.liebisch@adolfinum.de
|
||||
christian.pickardt@adolfinum.de
|
||||
jan.schliekmann@adolfinum.de
|
||||
elsa.piplack@adolfinum.de
|
||||
jolan.gerritzen@adolfinum.de
|
||||
lorena.garau@adolfinum.de
|
||||
matthias.karl@adolfinum.de
|
||||
justin.kauschke@adolfinum.de
|
||||
leonie.kramer@adolfinum.de
|
||||
laura.kurreck@adolfinum.de
|
||||
maya.lueck@adolfinum.de
|
||||
sean.mccormick-silex@adolfinum.de
|
||||
tim.mueller@adolfinum.de
|
||||
lana.peric@adolfinum.de
|
||||
jan.pintostrohhaeusl@adolfinum.de
|
||||
laura.ruettershoff@adolfinum.de
|
||||
charlotte.schirmer@adolfinum.de
|
||||
lavinia.schmitz@adolfinum.de
|
||||
victor.schroers@adolfinum.de
|
||||
gerrit.schulz@adolfinum.de
|
||||
clemens.spoo@adolfinum.de
|
||||
simon.stavroulakis@adolfinum.de
|
||||
ioannis.boerner@adolfinum.de
|
||||
marwa.nafouti@adolfinum.de
|
||||
Binary file not shown.
33
src/main/resources/templates/addingCandidates.html
Normal file
33
src/main/resources/templates/addingCandidates.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="https://www.thymeleaf.org/">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</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="*{candidates[__${itemStat.index}__].name}" /></td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="submit" id="submitButton" th:value="Confirm"></button>
|
||||
</fieldset>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
10
src/main/resources/templates/voteSuccessful.html
Normal file
10
src/main/resources/templates/voteSuccessful.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user