Skip to content

Commit 5290a73

Browse files
author
Christian Wansart
committed
reformat templates
1 parent 2fafae5 commit 5290a73

File tree

6 files changed

+155
-133
lines changed

6 files changed

+155
-133
lines changed
Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
<!DOCTYPE HTML>
22
<html xmlns:th="http://www.thymeleaf.org">
3-
<head>
4-
<title>Delete</title>
3+
4+
<head>
5+
<title>Delete</title>
56
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6-
<link href="/css/bootstrap.min.css" rel="stylesheet">
7-
<script src="/js/bootstrap.bundle.min.js"></script>
7+
<link href="/css/bootstrap.min.css" rel="stylesheet">
8+
<script src="/js/bootstrap.bundle.min.js"></script>
89
</head>
10+
911
<body>
10-
<div class="container">
11-
<form class="form-create" method="POST" th:action="@{/delete(id=${id})}" th:object="${createForm}">
12-
<h2 class="form-heading">Confirm Delete</h2>
12+
<div class="container">
13+
<form class="form-create" method="POST" th:action="@{/delete(id=${id})}" th:object="${createForm}">
14+
<h2 class="form-heading">Confirm Delete</h2>
1315

14-
<div class="form-group">
15-
<h3 th:text="${'Are you sure you want to delete poll #' + id + '?'}"/>
16-
17-
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
16+
<div class="form-group">
17+
<h3 th:text="${'Are you sure you want to delete poll #' + id + '?'}" />
1818

19-
<button class="btn btn-lg btn-primary btn-block" type="submit">Delete</button>
20-
</div>
21-
</form>
22-
</div>
19+
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
20+
21+
<button class="btn btn-lg btn-primary btn-block" type="submit">Delete</button>
22+
</div>
23+
</form>
24+
</div>
2325
</body>
26+
2427
</html>
Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,39 @@
11
<!DOCTYPE HTML>
22
<html xmlns:th="http://www.thymeleaf.org">
3-
<head>
4-
<title>Create New Poll</title>
3+
4+
<head>
5+
<title>Create New Poll</title>
56
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6-
<link href="/css/bootstrap.min.css" rel="stylesheet">
7-
<script src="/js/bootstrap.bundle.min.js"></script>
7+
<link href="/css/bootstrap.min.css" rel="stylesheet">
8+
<script src="/js/bootstrap.bundle.min.js"></script>
89
</head>
10+
911
<body>
10-
<div class="container">
11-
<form class="form-create" method="POST" th:action="@{/create}" th:object="${createForm}">
12-
<h2 class="form-heading">Create New Poll</h2>
12+
<div class="container">
13+
<form class="form-create" method="POST" th:action="@{/create}" th:object="${createForm}">
14+
<h2 class="form-heading">Create New Poll</h2>
1315

14-
<div class="mb-3">
15-
<label for="name-input" class="form-label">Name</label>
16-
<input type="text" th:class="${name_error}? 'is-invalid form-control' : 'form-control'" id="name-input" placeholder="University 04-2024" th:field="*{name}"/>
17-
<div class="invalid-feedback" th:text="${name_error}"/>
18-
</div>
19-
<div class="mb-3">
20-
<label for="topics-input" class="form-label">Topics</label>
21-
<textarea th:class="${topics_error}? 'is-invalid form-control' : 'form-control'" id="topics-input" rows="5" aria-describedby="topics-help-block" th:field="*{topics}"/>
22-
<div id="topics-help-block" class="form-text">
23-
One topic per line.
24-
</div>
25-
<div class="invalid-feedback" th:text="${topics_error}"/>
26-
</div>
27-
28-
<div class="btn-group" role="group" aria-label="Create Button Box">
29-
<button class="btn btn-primary" type="submit">Create</button>
30-
</div>
31-
</form>
32-
</div>
16+
<div class="mb-3">
17+
<label for="name-input" class="form-label">Name</label>
18+
<input type="text" th:class="${name_error}? 'is-invalid form-control' : 'form-control'" id="name-input"
19+
placeholder="University 04-2024" th:field="*{name}" />
20+
<div class="invalid-feedback" th:text="${name_error}" />
21+
</div>
22+
<div class="mb-3">
23+
<label for="topics-input" class="form-label">Topics</label>
24+
<textarea th:class="${topics_error}? 'is-invalid form-control' : 'form-control'" id="topics-input"
25+
rows="5" aria-describedby="topics-help-block" th:field="*{topics}" />
26+
<div id="topics-help-block" class="form-text">
27+
One topic per line.
28+
</div>
29+
<div class="invalid-feedback" th:text="${topics_error}" />
30+
</div>
31+
32+
<div class="btn-group" role="group" aria-label="Create Button Box">
33+
<button class="btn btn-primary" type="submit">Create</button>
34+
</div>
35+
</form>
36+
</div>
3337
</body>
38+
3439
</html>

src/main/resources/templates/list.html

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,52 @@
22
<html xmlns:th="http://www.thymeleaf.org">
33

44
<head>
5-
<title>All Polls</title>
6-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7-
<link href="/css/bootstrap.min.css" rel="stylesheet">
8-
<script src="/js/bootstrap.bundle.min.js"></script>
5+
<title>All Polls</title>
6+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7+
<link href="/css/bootstrap.min.css" rel="stylesheet">
8+
<script src="/js/bootstrap.bundle.min.js"></script>
99
</head>
1010

1111
<body>
12-
<div class="container">
13-
<h2 class="form-heading">List of all polls</h2>
14-
<h3 th:text="${'Total of ' + totalNum + ' polls.'}"/>
15-
16-
<div class="container mb-3">
17-
<div class="row align-items-start">
18-
<div class="col border border-info bg-info bg-opacity-10">Name</div>
19-
<div class="col border border-info bg-info bg-opacity-10">Votes</div>
20-
<div class="col border border-info bg-info bg-opacity-10">Deleted</div>
21-
<div class="col border border-info bg-info bg-opacity-10">Actions</div>
22-
</div>
23-
<div class="row align-items-start" th:each="poll: ${polls}">
24-
<div class="col border" th:text="${poll.name}"/>
25-
<div class="col border" th:text="${poll.choices.size()}" />
26-
<div class="col border" th:text="${{poll.deleted}}" />
27-
<div class="col border">
28-
<a th:href="@{/delete(id=${poll.id})}">Delete</a>
29-
<a th:href="@{/vote(id=${poll.id})}">Participate</a>
30-
<a th:href="@{/results(id=${poll.id})}">Show results</a>
31-
</div>
32-
</div>
33-
</div>
34-
35-
<div class="container mb-3">
36-
<div class="row align-items-start"></div>
37-
<nav aria-label="Page navigation">
38-
<ul class="pagination">
39-
<li th:class="${currentPage == 1} ? 'page-item disabled' : 'page-item'"><a class="page-link" th:href="${currentPage == 1} ? '#' : '@{/list(p=${currentPage-1})}'">Previous</a></li>
40-
<!--<li class="page-item"><a class="page-link" href="#">1</a></li>
12+
<div class="container">
13+
<h2 class="form-heading">List of all polls</h2>
14+
<h3 th:text="${'Total of ' + totalNum + ' polls.'}" />
15+
16+
<div class="container mb-3">
17+
<div class="row align-items-start">
18+
<div class="col border border-info bg-info bg-opacity-10">Name</div>
19+
<div class="col border border-info bg-info bg-opacity-10">Votes</div>
20+
<div class="col border border-info bg-info bg-opacity-10">Deleted</div>
21+
<div class="col border border-info bg-info bg-opacity-10">Actions</div>
22+
</div>
23+
<div class="row align-items-start" th:each="poll: ${polls}">
24+
<div class="col border" th:text="${poll.name}" />
25+
<div class="col border" th:text="${poll.choices.size()}" />
26+
<div class="col border" th:text="${{poll.deleted}}" />
27+
<div class="col border">
28+
<a th:href="@{/delete(id=${poll.id})}">Delete</a>
29+
<a th:href="@{/vote(id=${poll.id})}">Participate</a>
30+
<a th:href="@{/results(id=${poll.id})}">Show results</a>
31+
</div>
32+
</div>
33+
</div>
34+
35+
<div class="container mb-3">
36+
<div class="row align-items-start"></div>
37+
<nav aria-label="Page navigation">
38+
<ul class="pagination">
39+
<li th:class="${currentPage == 1} ? 'page-item disabled' : 'page-item'"><a class="page-link"
40+
th:href="${currentPage == 1} ? '#' : '@{/list(p=${currentPage-1})}'">Previous</a></li>
41+
<!--<li class="page-item"><a class="page-link" href="#">1</a></li>
4142
<li class="page-item"><a class="page-link" href="#">2</a></li>
4243
<li class="page-item"><a class="page-link" href="#">3</a></li>-->
43-
<li th:class="${currentPage == totalPages} ? 'page-item disabled' : 'page-item'"><a class="page-link" th:href="${currentPage == totalPages} ? '#' : '@{/list(p=${currentPage+1})}'">Next</a></li>
44-
</ul>
45-
</nav>
46-
</div>
47-
</div>
44+
<li th:class="${currentPage == totalPages} ? 'page-item disabled' : 'page-item'"><a
45+
class="page-link"
46+
th:href="${currentPage == totalPages} ? '#' : '@{/list(p=${currentPage+1})}'">Next</a></li>
47+
</ul>
48+
</nav>
49+
</div>
50+
</div>
4851
</body>
4952

5053
</html>
Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
11
<!DOCTYPE HTML>
22
<html xmlns:th="http://www.thymeleaf.org">
3-
<head>
4-
<title>Login</title>
3+
4+
<head>
5+
<title>Login</title>
56
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6-
<link href="/css/bootstrap.min.css" rel="stylesheet">
7-
<script src="/js/bootstrap.bundle.min.js"></script>
7+
<link href="/css/bootstrap.min.css" rel="stylesheet">
8+
<script src="/js/bootstrap.bundle.min.js"></script>
89
</head>
10+
911
<body>
1012
<div class="container">
1113

12-
<form class="form-signin" method="POST" th:action="@{/login(p=${page})}" th:object="${loginForm}">
13-
<h2 class="form-heading">Log in</h2>
14+
<form class="form-signin" method="POST" th:action="@{/login(p=${page})}" th:object="${loginForm}">
15+
<h2 class="form-heading">Log in</h2>
1416

15-
<div class="input-group mb-3">
16-
<span class="input-group-text" id="password-input">Password</span>
17-
<input type="password" th:class="${error}? 'is-invalid form-control' : 'form-control'" placeholder="Password" aria-label="Password" aria-describedby="password-input" th:field="*{password}"/>
18-
<div class="invalid-feedback" th:text="${error}"/>
19-
</div>
20-
21-
<div class="btn-group" role="group" aria-label="Login Button Box">
22-
<button class="btn btn-primary" type="submit">Log In</button>
23-
</div>
24-
</form>
17+
<div class="input-group mb-3">
18+
<span class="input-group-text" id="password-input">Password</span>
19+
<input type="password" th:class="${error}? 'is-invalid form-control' : 'form-control'"
20+
placeholder="Password" aria-label="Password" aria-describedby="password-input"
21+
th:field="*{password}" />
22+
<div class="invalid-feedback" th:text="${error}" />
23+
</div>
24+
25+
<div class="btn-group" role="group" aria-label="Login Button Box">
26+
<button class="btn btn-primary" type="submit">Log In</button>
27+
</div>
28+
</form>
2529
</div>
2630
</body>
31+
2732
</html>
Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
<!DOCTYPE HTML>
22
<html xmlns:th="http://www.thymeleaf.org">
3-
<head>
4-
<title>Poll Result</title>
3+
4+
<head>
5+
<title>Poll Result</title>
56
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6-
<link href="/css/bootstrap.min.css" rel="stylesheet">
7-
<script src="/js/bootstrap.bundle.min.js"></script>
7+
<link href="/css/bootstrap.min.css" rel="stylesheet">
8+
<script src="/js/bootstrap.bundle.min.js"></script>
89
</head>
10+
911
<body>
10-
<div class="container">
11-
<h2 class="form-heading" th:text="${'Results for poll #' + id}"></h2>
12-
<h3 th:text="${name}"></h3>
13-
14-
<div class="container mb-3">
15-
<div class="row align-items-start">
16-
<div class="col border border-info bg-info bg-opacity-10">Choice</div>
17-
<div class="col border border-info bg-info bg-opacity-10">Votes</div>
18-
</div>
19-
<div class="row align-items-start" th:each="result: ${results}">
20-
<div class="col border" th:text="${result.name}"/>
21-
<div class="col border" th:text="${result.count}" />
22-
</div>
23-
</div>
24-
</div>
12+
<div class="container">
13+
<h2 class="form-heading" th:text="${'Results for poll #' + id}"></h2>
14+
<h3 th:text="${name}"></h3>
15+
16+
<div class="container mb-3">
17+
<div class="row align-items-start">
18+
<div class="col border border-info bg-info bg-opacity-10">Choice</div>
19+
<div class="col border border-info bg-info bg-opacity-10">Votes</div>
20+
</div>
21+
<div class="row align-items-start" th:each="result: ${results}">
22+
<div class="col border" th:text="${result.name}" />
23+
<div class="col border" th:text="${result.count}" />
24+
</div>
25+
</div>
26+
</div>
2527
</body>
28+
2629
</html>
Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
<!DOCTYPE HTML>
22
<html xmlns:th="http://www.thymeleaf.org">
3-
<head>
4-
<title>Vote</title>
3+
4+
<head>
5+
<title>Vote</title>
56
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6-
<link href="/css/bootstrap.min.css" rel="stylesheet">
7-
<script src="/js/bootstrap.bundle.min.js"></script>
7+
<link href="/css/bootstrap.min.css" rel="stylesheet">
8+
<script src="/js/bootstrap.bundle.min.js"></script>
89
</head>
10+
911
<body>
10-
<div class="container">
11-
<form class="form-vote" method="POST" th:action="@{/vote(id=${id})}" th:object="${voteForm}">
12-
<h2 class="form-heading">Please select your choices and vote!</h2>
13-
<div class="form-group">
14-
<div class="form-check" th:each="choice: ${choices}">
15-
<input class="form-check-input" type="checkbox" th:value="${choice.id}" th:field="*{selected}"/>
16-
<label class="form-check-label" th:for="${#ids.prev('selected')}" th:text="${choice.name}"/>
17-
</div>
18-
19-
<div class="btn-group" role="group" aria-label="Vote Button Box">
20-
<button class="btn btn-primary" type="submit">Vote</button>
21-
</div>
22-
</div>
23-
</form>
24-
</div>
12+
<div class="container">
13+
<form class="form-vote" method="POST" th:action="@{/vote(id=${id})}" th:object="${voteForm}">
14+
<h2 class="form-heading">Please select your choices and vote!</h2>
15+
<div class="form-group">
16+
<div class="form-check" th:each="choice: ${choices}">
17+
<input class="form-check-input" type="checkbox" th:value="${choice.id}" th:field="*{selected}" />
18+
<label class="form-check-label" th:for="${#ids.prev('selected')}" th:text="${choice.name}" />
19+
</div>
20+
21+
<div class="btn-group" role="group" aria-label="Vote Button Box">
22+
<button class="btn btn-primary" type="submit">Vote</button>
23+
</div>
24+
</div>
25+
</form>
26+
</div>
2527
</body>
28+
2629
</html>

0 commit comments

Comments
 (0)