Skip to content

Commit 82cc873

Browse files
committed
Learned about fragments
1 parent ef9b552 commit 82cc873

7 files changed

Lines changed: 47 additions & 30 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package org.launchcode.codingevents.models;
2+
3+
public class Event {
4+
}

src/main/resources/static/script.js

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body {
2+
font-size: 32px;
3+
color:blueviolet;
4+
}
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
<!DOCTYPE html>
22
<html lang="en" xmlns:th="https://www.thymeleaf.org">
3-
<head>
4-
<meta charset="UTF-8"/>
5-
<title>Create Event</title>
6-
</head>
7-
<body>
3+
<head th:replace="~{fragments :: head}"></head>
4+
5+
<body class="container">
86
<h1>Create Event</h1>
97

108
<nav th:replace="~{fragments :: navigation}"></nav>
119

12-
<form method="post" >
13-
<input type="text" name="eventName">
14-
<input type="submit" value="Create Event">
10+
<form method="post">
11+
<div class="form-group">
12+
<label>Name
13+
<input type="text" name="eventName" class="form-control">
14+
</label>
15+
</div>
16+
<div class="form-group">
17+
<input type="submit" value="Create Event" class="btn btn-success">
18+
</div>
1519
</form>
1620
</body>
1721
</html>
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
<!DOCTYPE html>
22
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
3-
<head>
4-
<meta charset="UTF-8"/>
5-
<title>Coding Events</title>
6-
</head>
7-
<body>
3+
<head th:replace="~{fragments :: head}"></head>
4+
<body class="container">
85

96
<h1>All Events</h1>
107

118
<nav th:replace="~{fragments :: navigation}"></nav>
129

1310
<p th:unless="${events} and ${events.size()}">No events!</p>
1411

15-
<ul>
16-
<th:block th:each="event : ${events}">
17-
<li th:text="${event}"></li>
18-
</th:block>
19-
</ul>
12+
<table>
13+
<thead>
14+
<tr>
15+
<th>Name</th>
16+
</tr>
17+
</thead>
18+
<tr th:each="event : ${events}">
19+
<td th:text="${event}"></td>
20+
</tr>
21+
</table>
2022

2123
</body>
2224
</html>
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
<!DOCTYPE html>
22
<html lang="en" xmlns:th="https://www.thymeleaf.org">
3-
<head>
3+
4+
<head th:fragment="head">
45
<meta charset="UTF-8"/>
5-
<title></title>
6+
<title>Coding Events</title>
7+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
8+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
69
</head>
7-
<body>
810

11+
<body>
912

1013
<nav th:fragment="navigation">
11-
<ul>
12-
<li><a href="/events">All Events</a></li>
13-
<li><a href="/events/create">Create Event</a></li>
14+
<ul class="nav">
15+
<li class="nav-item"><a class="nav-link" th:href="@{/events}">All Events</a></li>
16+
<li class="nav-item"><a class="nav-link" th:href="@{/events/create}">Create Event</a></li>
1417
</ul>
18+
</nav>
19+
1520
</body>
16-
</html>
21+
</html>

src/main/resources/templates/index.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<!DOCTYPE html>
22
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
3-
<head>
4-
<meta charset="UTF-8"/>
5-
<title>Coding Events</title>
6-
</head>
7-
<body>
3+
<head th:replace="~{fragments :: head}"></head>
4+
5+
<body class="container">
86

97
<h1>Coding Events</h1>
108

0 commit comments

Comments
 (0)