Skip to content
Snippets Groups Projects
Commit e38a9fee authored by Dave Syer's avatar Dave Syer
Browse files

Convert to jar with thymeleaf

parent 3450c3d9
No related branches found
No related tags found
No related merge requests found
Showing
with 440 additions and 0 deletions
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'error')}">
<body>
<img src="../static/resources/images/pets.png" th:src="@{/resources/images/pets.png}"/>
<h2>Something happened...</h2>
<p th:text="${message}">Exception message</p>
</body>
</html>
\ No newline at end of file
<html>
<body>
<form>
<th:block th:fragment="input (label, name)">
<div th:with="valid=${!#fields.hasErrors(name)}"
th:class="${'form-group' + (valid ? '' : ' has-error')}"
class="form-group">
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
<div class="col-sm-10">
<input class="form-control" type="text"
th:field="*{__${name}__}" />
<span th:if="${valid}"
class="glyphicon glyphicon-ok form-control-feedback"
aria-hidden="true"></span>
<th:block th:if="${!valid}">
<span
class="glyphicon glyphicon-remove form-control-feedback"
aria-hidden="true"></span>
<span class="help-inline" th:errors="*{__${name}__}">Error</span>
</th:block>
</div>
</div>
</th:block>
</form>
</body>
</html>
<!doctype html>
<html th:fragment="layout (template, menu)">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" th:href="@{/resources/images/favicon.png}">
<title>PetClinic :: a Spring Framework demonstration</title>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" th:href="@{/resources/css/petclinic.css}"/>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" th:href="@{/}"><span></span></a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar">
<span class="sr-only"><os-p>Toggle navigation</os-p></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="main-navbar">
<ul class="nav navbar-nav navbar-right">
<li th:fragment="menuItem (path,active,title,glyph,text)" class="active" th:class="${active==menu ? 'active' : ''}">
<a th:href="@{__${path}__}" th:title="${title}">
<span th:class="'glyphicon glyphicon-'+${glyph}" class="glyphicon glyphicon-home" aria-hidden="true"></span>
<span th:text="${text}">Template</span>
</a>
</li>
<li th:replace="::menuItem ('/','home','home page','home','Home')">
<span class="glyphicon glyphicon-home" aria-hidden="true"></span>
<span>Home</span>
</li>
<li th:replace="::menuItem ('/owners/find','owners','find owners','search','Find owners')">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
<span>Find owners</span>
</li>
<li th:replace="::menuItem ('/vets.html','vets','veterinarians','th-list','Veterinarians')">
<span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
<span>Veterinarians</span>
</li>
<li th:replace="::menuItem ('/oups','error','trigger a RuntimeException to see how it is handled','th-warning-sign','Error')">
<span class="glyphicon glyphicon-warning-sign" aria-hidden="true"></span>
<span>Error</span>
</li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="container xd-container">
<div th:replace="${template}"/>
<br/>
<br/>
<div class="container">
<div class="row">
<div class="col-12 text-center">
<img src="../static/resources/images/spring-pivotal-logo.png" th:src="@{/resources/images/spring-pivotal-logo.png}"
alt="Sponsored by Pivotal"/></div>
</div>
</div>
</div>
</div>
<script th:src="@{/webjars/jquery/jquery.min.js}"></script>
<script th:src="@{/webjars/jquery-ui/jquery-ui.min.js}"></script>
<script th:src="@{/webjars/bootstrap/js/bootstrap.min.js}"></script>
</body>
</html>
<html>
<body>
<form>
<th:block th:fragment="select (label, name, items)">
<div th:with="valid=${!#fields.hasErrors(name)}"
th:class="${'form-group' + (valid ? '' : ' has-error')}"
class="form-group">
<label class="col-sm-2 control-label" th:text="${label}">Label</label>
<div class="col-sm-10">
<select th:field="*{__${name}__}">
<option th:each="item : ${items}" th:value="${item}"
th:text="${item}">dog</option>
</select>
<span th:if="${valid}"
class="glyphicon glyphicon-ok form-control-feedback"
aria-hidden="true"></span>
<th:block th:if="${!valid}">
<span
class="glyphicon glyphicon-remove form-control-feedback"
aria-hidden="true"></span>
<span class="help-inline" th:errors="*{__${name}__}">Error</span>
</th:block>
</div>
</div>
</th:block>
</form>
</body>
</html>
\ No newline at end of file
<html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
<body>
<h2>Owner</h2>
<form th:object="${owner}" class="form-horizontal" id="add-owner-form" method="post">
<div class="form-group has-feedback">
<input
th:replace="~{fragments/inputField :: input ('First Name', 'firstName')}" />
<input
th:replace="~{fragments/inputField :: input ('Last Name', 'lastName')}" />
<input
th:replace="~{fragments/inputField :: input ('Address', 'address')}" />
<input
th:replace="~{fragments/inputField :: input ('City', 'city')}" />
<input
th:replace="~{fragments/inputField :: input ('Telephone', 'telephone')}" />
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button
th:with="text=${owner['new']} ? 'Add Owner' : 'Update Owner'"
class="btn btn-default" type="submit" th:text="${text}">Add
Owner</button>
</div>
</div>
</form>
</body>
</html>
<html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
<body>
<h2>Find Owners</h2>
<form th:object="${owner}" th:action="@{/owners}" method="get"
class="form-horizontal" id="search-owner-form">
<div class="form-group">
<div class="control-group" id="lastName">
<label class="col-sm-2 control-label">Last name </label>
<div class="col-sm-10">
<input class="form-control" th:field="*{lastName}" size="30"
maxlength="80" /> <span class="help-inline"><div
th:if="${#fields.hasAnyErrors()}">
<p th:each="err : ${#fields.allErrors()}" th:text="${err}">Error</p>
</div></span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Find
Owner</button>
</div>
</div>
</form>
<br />
<a class="btn btn-default" th:href="@{/owners/new}">Add Owner</a>
</body>
</html>
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
<body>
<h2>Owner Information</h2>
<table class="table table-striped" th:object="${owner}">
<tr>
<th>Name</th>
<td><b th:text="*{firstName + ' ' + lastName}"></b></td>
</tr>
<tr>
<th>Address</th>
<td th:text="*{address}" /></td>
</tr>
<tr>
<th>City</th>
<td th:text="*{city}" /></td>
</tr>
<tr>
<th>Telephone</th>
<td th:text="*{telephone}" /></td>
</tr>
</table>
<a th:href="@{{id}/edit(id=${owner.id})}" class="btn btn-default">Edit
Owner</a>
<a th:href="@{{id}/pets/new(id=${owner.id})}" class="btn btn-default">Add
New Pet</a>
<br />
<br />
<br />
<h2>Pets and Visits</h2>
<table class="table table-striped">
<tr th:each="pet : ${owner.pets}">
<td valign="top">
<dl class="dl-horizontal">
<dt>Name</dt>
<dd th:text="${pet.name}" /></dd>
<dt>Birth Date</dt>
<dd
th:text="${#calendars.format(pet.birthDate, 'yyyy-MM-dd')}" /></dd>
<dt>Type</dt>
<dd th:text="${pet.type}" /></dd>
</dl>
</td>
<td valign="top">
<table class="table-condensed">
<thead>
<tr>
<th>Visit Date</th>
<th>Description</th>
</tr>
</thead>
<tr th:each="visit : ${pet.visits}">
<td th:text="${#calendars.format(visit.date, 'yyyy-MM-dd')}"></td>
<td th:text="${visit?.description}"></td>
</tr>
<tr>
<td><a
th:href="@{{ownerId}/pets/{petId}/edit(ownerId=${owner.id},petId=${pet.id})}">Edit
Pet</a></td>
<td><a
th:href="@{{ownerId}/pets/{petId}/visits/new(ownerId=${owner.id},petId=${pet.id})}">Add
Visit</a></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
<body>
<h2>Owners</h2>
<table id="vets" class="table table-striped">
<thead>
<tr>
<th style="width: 150px;">Name</th>
<th style="width: 200px;">Address</th>
<th>City</th>
<th style="width: 120px">Telephone</th>
<th>Pets</th>
</tr>
</thead>
<tbody>
<tr th:each="owner : ${selections}">
<td>
<a th:href="@{owners/__${owner.id}__}" th:text="${owner.firstName + ' ' + owner.lastName}"/></a>
</td>
<td th:text="${owner.address}"/>
<td th:text="${owner.city}"/>
<td th:text="${owner.telephone}"/>
<td><span th:each="pet : ${owner.pets}" th:text="${pet.name} "/></td>
</tr>
</tbody>
</table>
</body>
</html>
<html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
<body>
<h2>
<th:block th:if="${pet['new']}">New </th:block>
Pet
</h2>
<form th:object="${pet}" class="form-horizontal" method="post">
<input type="hidden" name="id" th:value="*{id}" />
<div class="form-group has-feedback">
<div class="form-group">
<label class="col-sm-2 control-label">Owner</label>
<div class="col-sm-10">
<span th:text="${pet.owner?.firstName + ' ' + pet.owner?.lastName}" />
</div>
</div>
<input
th:replace="~{fragments/inputField :: input ('Name', 'name')}" />
<input
th:replace="~{fragments/inputField :: input ('Birth Date', 'birthDate')}" />
<input
th:replace="~{fragments/selectField :: select ('Type', 'type', ${types})}" />
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button
th:with="text=${owner['new']} ? 'Add Pet' : 'Update Pet'"
class="btn btn-default" type="submit" th:text="${text}">Add
Pet</button>
</div>
</div>
</form>
</body>
</html>
\ No newline at end of file
<html xmlns:th="http://www.thymeleaf.org"
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
<body>
<h2>
<th:block th:if="${visit['new']}">New </th:block>
Visit
</h2>
<b>Pet</b>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Birth Date</th>
<th>Type</th>
<th>Owner</th>
</tr>
</thead>
<tr>
<td th:text="${visit.pet.name}" /></td>
<td
th:text="${#calendars.format(visit.pet.birthDate, 'yyyy-MM-dd')}" /></td>
<td th:text="${visit.pet.type}" /></td>
<td
th:text="${visit.pet.owner?.firstName + ' ' + visit.pet.owner?.lastName}" /></td>
</tr>
</table>
<form th:object="${visit}" class="form-horizontal" method="post">
<div class="form-group has-feedback">
<input
th:replace="~{fragments/inputField :: input ('Date', 'date')}" />
<input
th:replace="~{fragments/inputField :: input ('Description', 'description')}" />
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="petId" th:value="${visit.pet.id}" />
<button class="btn btn-default" type="submit">Add Visit</button>
</div>
</div>
</form>
<br />
<b>Previous Visits</b>
<table class="table table-striped">
<tr>
<th>Date</th>
<th>Description</th>
</tr>
<tr th:if="${!visit['new']}" th:each="visit : ${visit.pet.visits}">
<td th:text="${#calendars.format(visit.date, 'yyyy-MM-dd')}" /></td>
<td th:text=" ${visit.description}" /></td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment