Browse Source

Set more flexible naming scheme for template URLs, get from Controller

Signed-off-by: Pekka Helenius <fincer89@hotmail.com>
v0.0.1-alpha
Pekka Helenius 4 years ago
parent
commit
3457982d9b
3 changed files with 6 additions and 6 deletions
  1. +2
    -2
      bookstore/src/main/resources/templates/bookadd.html
  2. +1
    -1
      bookstore/src/main/resources/templates/bookedit.html
  3. +3
    -3
      bookstore/src/main/resources/templates/booklist.html

+ 2
- 2
bookstore/src/main/resources/templates/bookadd.html View File

@ -9,7 +9,7 @@
<div class="col-md-4 mb-3">
<h1>Add new book</h1>
<form th:object="${book}" action="#" th:action="@{bookadd}" method="post">
<form th:object="${book}" action="#" th:action="@{__${addpage}__}" method="post">
<div class="form-group">
<label for="BookAuthor">Author</label>
@ -62,7 +62,7 @@
</form>
<br>
<form action="#" th:action="@{booklist}" method="get">
<form action="#" th:action="@{__${listpage}__}" method="get">
<button class="btn btn-success" type="submit">Return to book list page</button>
</form>


+ 1
- 1
bookstore/src/main/resources/templates/bookedit.html View File

@ -62,7 +62,7 @@
<button class="btn btn-primary" type="submit">Update book</button>
</form>
<br>
<form action="#" th:action="@{../booklist}" method="get">
<form action="#" th:action="@{../__${listpage}__}" method="get">
<button class="btn btn-success" type="submit">Return to book list page</button>
</form>


+ 3
- 3
bookstore/src/main/resources/templates/booklist.html View File

@ -29,13 +29,13 @@
<td th:text="${#numbers.formatDecimal(book.price, 1, 2)}"></td>
<td><a class="btn btn-danger"
th:attr="onclick='javascript:return confirm(\'' + 'Delete book: ' + ${book.title} + '?' + '\');'"
th:href="@{bookdelete/{id}(id=${book.id})}">Delete</a></td>
th:href="@{__${deletepage}__/{id}(id=${book.id})}">Delete</a></td>
<td><a class="btn btn-warning"
th:href="@{bookedit/{id}(id=${book.id})}">Edit</a></td>
th:href="@{__${editpage}__/{id}(id=${book.id})}">Edit</a></td>
</tr>
</table>
<div>
<a class="btn btn-success" href="bookadd">Add Book</a>
<a class="btn btn-success" href="@{__${addpage}__}">Add Book</a>
</div>
</div>
</body>


Loading…
Cancel
Save