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"> <div class="col-md-4 mb-3">
<h1>Add new book</h1> <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"> <div class="form-group">
<label for="BookAuthor">Author</label> <label for="BookAuthor">Author</label>
@ -62,7 +62,7 @@
</form> </form>
<br> <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> <button class="btn btn-success" type="submit">Return to book list page</button>
</form> </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> <button class="btn btn-primary" type="submit">Update book</button>
</form> </form>
<br> <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> <button class="btn btn-success" type="submit">Return to book list page</button>
</form> </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 th:text="${#numbers.formatDecimal(book.price, 1, 2)}"></td>
<td><a class="btn btn-danger" <td><a class="btn btn-danger"
th:attr="onclick='javascript:return confirm(\'' + 'Delete book: ' + ${book.title} + '?' + '\');'" 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" <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> </tr>
</table> </table>
<div> <div>
<a class="btn btn-success" href="bookadd">Add Book</a>
<a class="btn btn-success" href="@{__${addpage}__}">Add Book</a>
</div> </div>
</div> </div>
</body> </body>


Loading…
Cancel
Save