mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:15:50 +00:00
Polish Thymeleaf templates.
Make sure we use the suggested fragment inclusion syntax. Use th:insert instead of th:include. Use simpler URI path segment templating to avoid duplication of expressions. Avoid trailing slashes in URIs creates as upcoming Spring Boot versions will not map the trailing slash flavors of defined URI mappings.
This commit is contained in:
parent
a5cbb8505a
commit
9ecdc1111e
4 changed files with 19 additions and 23 deletions
|
@ -45,23 +45,23 @@
|
||||||
|
|
||||||
<ul class="nav navbar-nav me-auto">
|
<ul class="nav navbar-nav me-auto">
|
||||||
|
|
||||||
<li th:replace="::menuItem ('/','home','home page','home','Home')">
|
<li th:replace="~{::menuItem ('/','home','home page','home','Home')}">
|
||||||
<span class="fa fa-home" aria-hidden="true"></span>
|
<span class="fa fa-home" aria-hidden="true"></span>
|
||||||
<span>Home</span>
|
<span>Home</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li th:replace="::menuItem ('/owners/find','owners','find owners','search','Find owners')">
|
<li th:replace="~{::menuItem ('/owners/find','owners','find owners','search','Find owners')}">
|
||||||
<span class="fa fa-search" aria-hidden="true"></span>
|
<span class="fa fa-search" aria-hidden="true"></span>
|
||||||
<span>Find owners</span>
|
<span>Find owners</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li th:replace="::menuItem ('/vets.html','vets','veterinarians','th-list','Veterinarians')">
|
<li th:replace="~{::menuItem ('/vets.html','vets','veterinarians','th-list','Veterinarians')}">
|
||||||
<span class="fa fa-th-list" aria-hidden="true"></span>
|
<span class="fa fa-th-list" aria-hidden="true"></span>
|
||||||
<span>Veterinarians</span>
|
<span>Veterinarians</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li
|
<li
|
||||||
th:replace="::menuItem ('/oups','error','trigger a RuntimeException to see how it is handled','exclamation-triangle','Error')">
|
th:replace="~{::menuItem ('/oups','error','trigger a RuntimeException to see how it is handled','exclamation-triangle','Error')}">
|
||||||
<span class="fa exclamation-triangle" aria-hidden="true"></span>
|
<span class="fa exclamation-triangle" aria-hidden="true"></span>
|
||||||
<span>Error</span>
|
<span>Error</span>
|
||||||
</li>
|
</li>
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="container xd-container">
|
<div class="container xd-container">
|
||||||
|
|
||||||
<th:block th:include="${template}" />
|
<th:block th:insert="${template}" />
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<a th:href="@{{id}/edit(id=${owner.id})}" class="btn btn-primary">Edit
|
<a th:href="@{__${owner.id}__/edit}" class="btn btn-primary">Edit
|
||||||
Owner</a>
|
Owner</a>
|
||||||
<a th:href="@{{id}/pets/new(id=${owner.id})}" class="btn btn-primary">Add
|
<a th:href="@{__${owner.id}__/pets/new}" class="btn btn-primary">Add
|
||||||
New Pet</a>
|
New Pet</a>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
@ -65,12 +65,8 @@
|
||||||
<td th:text="${visit?.description}"></td>
|
<td th:text="${visit?.description}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a
|
<td><a th:href="@{__${owner.id}__/pets/__${pet.id}__/edit}">Edit Pet</a></td>
|
||||||
th:href="@{{ownerId}/pets/{petId}/edit(ownerId=${owner.id},petId=${pet.id})}">Edit
|
<td><a th:href="@{__${owner.id}__/pets/__${pet.id}__/visits/new}">Add Visit</a></td>
|
||||||
Pet</a></td>
|
|
||||||
<td><a
|
|
||||||
th:href="@{{ownerId}/pets/{petId}/visits/new(ownerId=${owner.id},petId=${pet.id})}">Add
|
|
||||||
Visit</a></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -32,27 +32,27 @@
|
||||||
<span>Pages:</span>
|
<span>Pages:</span>
|
||||||
<span>[</span>
|
<span>[</span>
|
||||||
<span th:each="i: ${#numbers.sequence(1, totalPages)}">
|
<span th:each="i: ${#numbers.sequence(1, totalPages)}">
|
||||||
<a th:if="${currentPage != i}" th:href="@{'/owners/?page=' + ${i}}">[[${i}]]</a>
|
<a th:if="${currentPage != i}" th:href="@{'/owners?page=' + ${i}}">[[${i}]]</a>
|
||||||
<span th:unless="${currentPage != i}">[[${i}]]</span>
|
<span th:unless="${currentPage != i}">[[${i}]]</span>
|
||||||
</span>
|
</span>
|
||||||
<span>] </span>
|
<span>] </span>
|
||||||
<span>
|
<span>
|
||||||
<a th:if="${currentPage > 1}" th:href="@{'/owners/?page=1'}" title="First"
|
<a th:if="${currentPage > 1}" th:href="@{'/owners?page=1'}" title="First"
|
||||||
class="fa fa-fast-backward"></a>
|
class="fa fa-fast-backward"></a>
|
||||||
<span th:unless="${currentPage > 1}" title="First" class="fa fa-fast-backward"></span>
|
<span th:unless="${currentPage > 1}" title="First" class="fa fa-fast-backward"></span>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<a th:if="${currentPage > 1}" th:href="@{'/owners/?page=' + ${currentPage - 1}}" title="Previous"
|
<a th:if="${currentPage > 1}" th:href="@{'/owners?page=__${currentPage - 1}__'}" title="Previous"
|
||||||
class="fa fa-step-backward"></a>
|
class="fa fa-step-backward"></a>
|
||||||
<span th:unless="${currentPage > 1}" title="Previous" class="fa fa-step-backward"></span>
|
<span th:unless="${currentPage > 1}" title="Previous" class="fa fa-step-backward"></span>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<a th:if="${currentPage < totalPages}" th:href="@{'/owners/?page=' + ${currentPage + 1}}" title="Next"
|
<a th:if="${currentPage < totalPages}" th:href="@{'/owners?page=__${currentPage + 1}__'}" title="Next"
|
||||||
class="fa fa-step-forward"></a>
|
class="fa fa-step-forward"></a>
|
||||||
<span th:unless="${currentPage < totalPages}" title="Next" class="fa fa-step-forward"></span>
|
<span th:unless="${currentPage < totalPages}" title="Next" class="fa fa-step-forward"></span>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<a th:if="${currentPage < totalPages}" th:href="@{'/owners/?page=' + ${totalPages}}" title="Last"
|
<a th:if="${currentPage < totalPages}" th:href="@{'/owners?page=__${totalPages}__'}" title="Last"
|
||||||
class="fa fa-fast-forward"></a>
|
class="fa fa-fast-forward"></a>
|
||||||
<span th:unless="${currentPage < totalPages}" title="Last" class="fa fa-step-forward"></span>
|
<span th:unless="${currentPage < totalPages}" title="Last" class="fa fa-step-forward"></span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -28,27 +28,27 @@
|
||||||
<span>Pages:</span>
|
<span>Pages:</span>
|
||||||
<span>[</span>
|
<span>[</span>
|
||||||
<span th:each="i: ${#numbers.sequence(1, totalPages)}">
|
<span th:each="i: ${#numbers.sequence(1, totalPages)}">
|
||||||
<a th:if="${currentPage != i}" th:href="@{'/vets.html/?page=' + ${i}}">[[${i}]]</a>
|
<a th:if="${currentPage != i}" th:href="@{'/vets.html?page=__${i}__'}">[[${i}]]</a>
|
||||||
<span th:unless="${currentPage != i}">[[${i}]]</span>
|
<span th:unless="${currentPage != i}">[[${i}]]</span>
|
||||||
</span>
|
</span>
|
||||||
<span>] </span>
|
<span>] </span>
|
||||||
<span>
|
<span>
|
||||||
<a th:if="${currentPage > 1}" th:href="@{'/vets.html/?page=1'}" title="First"
|
<a th:if="${currentPage > 1}" th:href="@{'/vets.html?page=1'}" title="First"
|
||||||
class="fa fa-fast-backward"></a>
|
class="fa fa-fast-backward"></a>
|
||||||
<span th:unless="${currentPage > 1}" title="First" class="fa fa-fast-backward"></span>
|
<span th:unless="${currentPage > 1}" title="First" class="fa fa-fast-backward"></span>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<a th:if="${currentPage > 1}" th:href="@{'/vets.html/?page=' + ${currentPage - 1}}" title="Previous"
|
<a th:if="${currentPage > 1}" th:href="@{'/vets.html?page=__${currentPage - 1}__'}" title="Previous"
|
||||||
class="fa fa-step-backward"></a>
|
class="fa fa-step-backward"></a>
|
||||||
<span th:unless="${currentPage > 1}" title="Previous" class="fa fa-step-backward"></span>
|
<span th:unless="${currentPage > 1}" title="Previous" class="fa fa-step-backward"></span>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<a th:if="${currentPage < totalPages}" th:href="@{'/vets.html/?page=' + ${currentPage + 1}}" title="Next"
|
<a th:if="${currentPage < totalPages}" th:href="@{'/vets.html?page=__${currentPage + 1}__'}" title="Next"
|
||||||
class="fa fa-step-forward"></a>
|
class="fa fa-step-forward"></a>
|
||||||
<span th:unless="${currentPage < totalPages}" title="Next" class="fa fa-step-forward"></span>
|
<span th:unless="${currentPage < totalPages}" title="Next" class="fa fa-step-forward"></span>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<a th:if="${currentPage < totalPages}" th:href="@{'/vets.html/?page=' + ${totalPages}}" title="Last"
|
<a th:if="${currentPage < totalPages}" th:href="@{'/vets.html?page=__${totalPages}__'}" title="Last"
|
||||||
class="fa fa-fast-forward"></a>
|
class="fa fa-fast-forward"></a>
|
||||||
<span th:unless="${currentPage < totalPages}" title="Last" class="fa fa-fast-forward"></span>
|
<span th:unless="${currentPage < totalPages}" title="Last" class="fa fa-fast-forward"></span>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue