Descripción
Create a Thymeleaf list view for a given entity
File Template: ✅
Prefix
thyme:list
Scopes
html
Snippet de código
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>List of ${1:MyEntity}</title>
</head>
<body>
<h1>List of ${1:MyEntity}</h1>
<a th:href="@{'/${2:entidades}/new'}">Create New ${1:MyEntity}</a>
<table>
<thead>
<tr>
<!-- Add table headers for entity attributes -->
<th>ID</th>
<th>Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr th:each="item : ${items}">
<td th:text="${item.id}"></td>
<td th:text="${item.name}"></td>
<td>
<a th:href="@{'/${2:entidades}/' + ${item.id}}">View</a> |
<a th:href="@{'/${2:entidades}/' + ${item.id} + '/edit'}">Edit</a> |
<form th:action="@{'/${2:entidades}/' + ${item.id} + '/delete'}" method="post" style="display:inline">
<button type="submit">Delete</button>
</form>
</td>
</tr>
</tbody>
</table>
</body>
</html>