Browse Source

Format CSS + raw HTML correctly also without Java; set placeholders for

Spring message keys; minor changes to web forms
Signed-off-by: Pekka Helenius <fincer89@hotmail.com>
v0.0.1-alpha
Pekka Helenius 4 years ago
parent
commit
c498246b6d
4 changed files with 353 additions and 133 deletions
  1. +37
    -36
      bookstore/src/main/resources/messages.properties
  2. +130
    -36
      bookstore/src/main/resources/templates/bookadd.html
  3. +135
    -38
      bookstore/src/main/resources/templates/bookedit.html
  4. +51
    -23
      bookstore/src/main/resources/templates/booklist.html

+ 37
- 36
bookstore/src/main/resources/messages.properties View File

@ -1,21 +1,22 @@
# Keep as fall back values if multi-language support is added
typeMismatch.book.year = Invalid year format
typeMismatch.book.price = Invalid price format
book.author = Author
book.title = Title
book.isbn = ISBN
book.year = Year
book.price = Price
book.category = Category
book.desc.set.author = Set book author name
book.desc.set.title = Set book primary title
book.desc.set.isbn = Set book ISBN code
book.desc.set.year = Set book publication year
book.desc.set.price = Set book price
book.desc.set.category = Select appropriate category
# Message keys with values.
# Prepare environment for possible multi-language support
typeMismatch.book.year = Invalid year format
typeMismatch.book.price = Invalid price format
book.author = Author
book.title = Title
book.isbn = ISBN
book.year = Year
book.price = Price
book.category = Category
book.desc.set.author = Set book author name
book.desc.set.title = Set book primary title
book.desc.set.isbn = Set book ISBN code
book.desc.set.year = Set book publication year
book.desc.set.price = Set book price
book.desc.set.category = Select appropriate category
book.desc.example.headertext = Valid inputs (examples)
book.desc.example.author = Andrzej Sapkowski
@ -24,27 +25,27 @@ book.desc.example.isbn = 1212121-3 or 4545454-67 or 6767676-890
book.desc.example.year = 1854 or 2005
book.desc.example.price = 17 or 123.5 or 45.67
book.error.author = Invalid author name
book.error.title = Invalid title
book.error.isbn = Invalid ISBN code
book.error.year = Invalid year
book.error.price = Invalid price
book.error.author = Invalid author name
book.error.title = Invalid title
book.error.isbn = Invalid ISBN code
book.error.year = Invalid year
book.error.price = Invalid price
page.title.browser.list = Bookstore page
page.title.browser.add = Add book
page.title.browser.edit = Update book
page.title.browser.list = Bookstore page
page.title.browser.add = Add book
page.title.browser.edit = Update book
page.title.webform.list = Books
page.title.webform.add = Add new book
page.title.webform.edit = Update existing book
page.title.webform.list = Books
page.title.webform.add = Add new book
page.title.webform.edit = Update existing book
page.text.list.actions = Actions
page.text.list.delete = Delete
page.text.list.edit = Edit
page.text.list.actions = Actions
page.text.list.delete = Delete
page.text.list.edit = Edit
button.book.add = Add book
button.book.edit = Update book
button.book.add = Add book
button.book.edit = Update book
button.page.list.return = Return to book list page
button.page.list.return = Return to book list page
page.symbols.currency = \u20AC
page.symbols.currency = \u20AC

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

@ -2,99 +2,193 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" th:href="@{../css/bookstore.css}" />
<link type="text/css" rel="stylesheet" th:href="@{../css/bootstrap.min.css}" />
<title th:text="#{page.title.browser.add}"></title>
<link type="text/css" rel="stylesheet" href="../static/css/bookstore.css" th:href="@{../css/bookstore.css}" />
<link type="text/css" rel="stylesheet" href="../static/css/bootstrap.min.css" th:href="@{../css/bootstrap.min.css}" />
<title th:text="${#messages.msgOrNull('page.title.browser.add')} ?: 'page.title.browser.add'">
page.title.browser.add
</title>
</head>
<body>
<div class="col-md-4 mb-3">
<h1 th:text="#{page.title.webform.add}"></h1>
<h1 th:text="${#messages.msgOrNull('page.title.webform.add')} ?: 'page.title.webform.add'">
page.title.webform.add
</h1>
<form th:object="${book}" action="#" th:action="@{__${addpage}__}" method="post">
<div class="form-group bookform-section">
<label for="BookAuthor" th:text="#{book.author}"></label>
<label for="BookAuthor"
th:text="${#messages.msgOrNull('book.author')} ?: 'book.author'">
book.author
</label>
<input class="form-control" type="text" th:field="*{author}" placeholder="Book author"/>
<small class="form-text text-muted" th:text="#{book.desc.set.author}"></small>
<small style="display: inline-block;" class="form-text text-info" th:text="#{book.desc.example.headertext} + ': '"></small>
<small style="display: inline-block;" class="form-text text-muted" th:text="#{book.desc.example.author}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.author')} ?: 'book.desc.set.author'">
book.desc.set.author
</small>
<small style="display: inline-block;" class="form-text text-info"
th:text="(${#messages.msgOrNull('book.desc.example.headertext')} ?: 'book.desc.example.headertext') + ': '">
book.desc.example.headertext
</small>
<small style="display: inline-block;" class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.example.author')} ?: 'book.desc.example.author'">
book.desc.example.author
</small>
<div class="alert alert-danger mt-2" th:if="${#fields.hasErrors('author')}"
th:errors="*{author}">Invalid author name</div>
th:errors="*{author}">Invalid author value</div>
</div>
<div class="form-group bookform-section">
<label for="BookTitle" th:text="#{book.title}"></label>
<label for="BookTitle"
th:text="${#messages.msgOrNull('book.title')} ?: 'book.title'">
book.title
</label>
<input class="form-control" type="text" th:field="*{title}" placeholder="Book title"/>
<small class="form-text text-muted" th:text="#{book.desc.set.title}"></small>
<small style="display: inline-block;" class="form-text text-info" th:text="#{book.desc.example.headertext} + ': '"></small>
<small style="display: inline-block;" class="form-text text-muted" th:text="#{book.desc.example.title}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.title')} ?: 'book.desc.set.title'">
book.desc.set.title
</small>
<small style="display: inline-block;" class="form-text text-info"
th:text="(${#messages.msgOrNull('book.desc.example.headertext')} ?: 'book.desc.example.headertext') + ': '">
book.desc.example.headertext:
</small>
<small style="display: inline-block;" class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.example.title')} ?: 'book.desc.example.title'">
book.desc.example.title
</small>
<div class="alert alert-danger mt-2" th:if="${#fields.hasErrors('title')}"
th:errors="*{title}">Invalid title</div>
th:errors="*{title}">Invalid title value</div>
</div>
<div class="form-group bookform-section">
<label for="BookISBN" th:text="#{book.isbn}"></label>
<label for="BookISBN"
th:text="${#messages.msgOrNull('book.isbn')} ?: 'book.isbn'">
book.isbn
</label>
<input class="form-control" type="text" th:field="*{isbn}" placeholder="Book ISBN code"/>
<small class="form-text text-muted" th:text="#{book.desc.set.isbn}"></small>
<small style="display: inline-block;" class="form-text text-info" th:text="#{book.desc.example.headertext} + ': '"></small>
<small style="display: inline-block;" class="form-text text-muted" th:text="#{book.desc.example.isbn}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.isbn')} ?: 'book.desc.set.isbn'">
book.desc.set.isbn
</small>
<small style="display: inline-block;" class="form-text text-info"
th:text="(${#messages.msgOrNull('book.desc.example.headertext')} ?: 'book.desc.example.headertext') + ': '">
book.desc.example.headertext:
</small>
<small style="display: inline-block;" class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.example.isbn')} ?: 'book.desc.example.isbn'">
book.desc.example.isbn
</small>
<div class="alert alert-danger mt-2" th:if="${#fields.hasErrors('isbn')}"
th:errors="*{isbn}">Invalid ISBN code</div>
</div>
<div class="form-group bookform-section">
<label for="BookYear" th:text="#{book.year}"></label>
<label for="BookYear"
th:text="${#messages.msgOrNull('book.year')} ?: 'book.year'">
book.year
</label>
<input class="form-control" type="text" th:field="*{year}" placeholder="Book publication year (YYYY)"/>
<small class="form-text text-muted" th:text="#{book.desc.set.year}"></small>
<small style="display: inline-block;" class="form-text text-info" th:text="#{book.desc.example.headertext} + ': '"></small>
<small style="display: inline-block;" class="form-text text-muted" th:text="#{book.desc.example.year}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.year')} ?: 'book.desc.set.year'">
book.desc.set.year
</small>
<small style="display: inline-block;" class="form-text text-info"
th:text="(${#messages.msgOrNull('book.desc.example.headertext')} ?: 'book.desc.example.headertext') + ': '">
book.desc.example.headertext:
</small>
<small style="display: inline-block;" class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.example.year')} ?: 'book.desc.example.year'">
book.desc.example.year
</small>
<div class="alert alert-danger mt-2" th:if="${#fields.hasErrors('year')}"
th:errors="*{year}">Invalid year</div>
th:errors="*{year}">Invalid year value</div>
</div>
<div class="form-group bookform-section">
<label for="BookPrice" th:text="#{book.price}"></label>
<label for="BookPrice"
th:text="${#messages.msgOrNull('book.price')} ?: 'book.price'">
book.price
</label>
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text" th:text="#{page.symbols.currency}"></div>
<div class="input-group-text"
th:text="${#messages.msgOrNull('page.symbols.currency')} ?: 'page.symbols.currency'">
page.symbols.currency
</div>
</div>
<input class="form-control" type="text" th:field="*{price}" placeholder="0.00"/>
</div>
<small class="form-text text-muted" th:text="#{book.desc.set.price}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.price')} ?: 'book.desc.set.price'">
book.desc.set.price
</small>
<small style="display: inline-block;" class="form-text text-info"
th:text="(${#messages.msgOrNull('book.desc.example.headertext')} ?: 'book.desc.example.headertext') + ': '">
book.desc.example.headertext:
</small>
<small style="display: inline-block;" class="form-text text-info" th:text="#{book.desc.example.headertext} + ': '"></small>
<small style="display: inline-block;" class="form-text text-muted" th:text="#{book.desc.example.price}"></small>
<small style="display: inline-block;" class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.example.price')} ?: 'book.desc.example.price'">
book.desc.example.price
</small>
<div class="alert alert-danger mt-2" th:if="${#fields.hasErrors('price')}"
th:errors="*{price}">Invalid price</div>
th:errors="*{price}">Invalid price value</div>
</div>
<div class="form-group bookform-section">
<label for="BookCategory" th:text="#{book.category}"></label>
<label for="BookCategory"
th:text="${#messages.msgOrNull('book.category')} ?: 'book.category'">
book.category
</label>
<select class="form-control" th:field="*{category}">
<option
th:each="category : ${categories}"
th:value="${category.getId()}"
th:text="${category.getName()}"
></option>
th:value="${category.id}"
th:text="${category.name}"
>(obj) category.name</option>
</select>
<small class="form-text text-muted" th:text="#{book.desc.set.category}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.category')} ?: 'book.desc.set.category'">
book.desc.set.category
</small>
</div>
<button class="btn btn-primary" type="submit" th:text="#{button.book.add}"></button>
<button class="btn btn-primary" type="submit"
th:text="${#messages.msgOrNull('button.book.add')} ?: 'button.book.add'">
button.book.add
</button>
</form>
<br>
<form action="#" th:action="@{__${listpage}__}" method="get">
<button class="btn btn-success" type="submit" th:text="#{button.page.list.return}"></button>
<button class="btn btn-success" type="submit"
th:text="${#messages.msgOrNull('button.page.list.return')} ?: 'button.page.list.return'">
button.page.list.return
</button>
</form>
</div>


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

@ -2,99 +2,196 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" th:href="@{../css/bookstore.css}" />
<link type="text/css" rel="stylesheet" th:href="@{../css/bootstrap.min.css}" />
<title th:text="#{page.title.browser.edit}"></title>
<link type="text/css" rel="stylesheet" href="../static/css/bookstore.css" th:href="@{../css/bookstore.css}" />
<link type="text/css" rel="stylesheet" href="../static/css/bootstrap.min.css" th:href="@{../css/bootstrap.min.css}" />
<title th:text="${#messages.msgOrNull('page.title.browser.edit')} ?: 'page.title.browser.edit'">
page.title.browser.edit
</title>
</head>
<body>
<div class="col-md-4 mb-3">
<h1 th:text="#{page.title.webform.edit}"></h1>
<h1 th:text="${#messages.msgOrNull('page.title.webform.edit')} ?: 'page.title.webform.edit'">
page.title.webform.edit
</h1>
<form th:object="${book}" action="#" th:action="@{{id}(id=${book.id})}" method="post">
<div class="form-group bookform-section">
<label for="BookAuthor" th:text="#{book.author}"></label><br>
<label for="BookAuthor"
th:text="${#messages.msgOrNull('book.author')} ?: 'book.author'">
book.author
</label>
<input class="form-control" type="text" th:field="*{author}" placeholder="Book author"/>
<small class="form-text text-muted" th:text="#{book.desc.set.author}"></small>
<small style="display: inline-block;" class="form-text text-info" th:text="#{book.desc.example.headertext} + ': '"></small>
<small style="display: inline-block;" class="form-text text-muted" th:text="#{book.desc.example.author}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.author')} ?: 'book.desc.set.author'">
book.desc.set.author
</small>
<small style="display: inline-block;" class="form-text text-info"
th:text="(${#messages.msgOrNull('book.desc.example.headertext')} ?: 'book.desc.example.headertext') + ': '">
book.desc.example.headertext
</small>
<small style="display: inline-block;" class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.example.author')} ?: 'book.desc.example.author'">
book.desc.example.author
</small>
<div class="alert alert-danger mt-2" th:if="${#fields.hasErrors('author')}"
th:errors="*{author}">Invalid author name</div>
th:errors="*{author}">Invalid author value</div>
</div>
<div class="form-group bookform-section">
<label for="BookName" th:text="#{book.title}"></label><br>
<label for="BookName"
th:text="${#messages.msgOrNull('book.title')} ?: 'book.title'">
book.title
</label>
<input class="form-control" type="text" th:field="*{title}" placeholder="Book title"/>
<small class="form-text text-muted" th:text="#{book.desc.set.title}"></small>
<small style="display: inline-block;" class="form-text text-info" th:text="#{book.desc.example.headertext} + ': '"></small>
<small style="display: inline-block;" class="form-text text-muted" th:text="#{book.desc.example.title}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.title')} ?: 'book.desc.set.title'">
book.desc.set.title
</small>
<small style="display: inline-block;" class="form-text text-info"
th:text="(${#messages.msgOrNull('book.desc.example.headertext')} ?: 'book.desc.example.headertext') + ': '">
book.desc.example.headertext:
</small>
<small style="display: inline-block;" class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.example.title')} ?: 'book.desc.example.title'">
book.desc.example.title
</small>
<div class="alert alert-danger mt-2" th:if="${#fields.hasErrors('title')}"
th:errors="*{title}">Invalid title</div>
</div>
<div class="form-group bookform-section">
<label for="BookISBN" th:text="#{book.isbn}"></label><br>
<label for="BookISBN"
th:text="${#messages.msgOrNull('book.isbn')} ?: 'book.isbn'">
book.isbn
</label>
<input class="form-control" type="text" th:field="*{isbn}" placeholder="Book ISBN code"/>
<small class="form-text text-muted" th:text="#{book.desc.set.isbn}"></small>
<small style="display: inline-block;" class="form-text text-info" th:text="#{book.desc.example.headertext} + ': '"></small>
<small style="display: inline-block;" class="form-text text-muted" th:text="#{book.desc.example.isbn}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.isbn')} ?: 'book.desc.set.isbn'">
book.desc.set.isbn
</small>
<small style="display: inline-block;" class="form-text text-info"
th:text="(${#messages.msgOrNull('book.desc.example.headertext')} ?: 'book.desc.example.headertext') + ': '">
book.desc.example.headertext
</small>
<small style="display: inline-block;" class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.example.isbn')} ?: 'book.desc.example.isbn'">
book.desc.example.isbn
</small>
<div class="alert alert-danger mt-2" th:if="${#fields.hasErrors('isbn')}"
th:errors="*{isbn}">Invalid ISBN code</div>
th:errors="*{isbn}">Invalid ISBN code value</div>
</div>
<div class="form-group bookform-section">
<label for="BookYear" th:text="#{book.year}"></label><br>
<label for="BookYear"
th:text="${#messages.msgOrNull('book.year')} ?: 'book.year'">
book.year
</label>
<input class="form-control" type="text" th:field="*{year}" placeholder="Book publication year (YYYY)"/>
<small class="form-text text-muted" th:text="#{book.desc.set.year}"></small>
<small style="display: inline-block;" class="form-text text-info" th:text="#{book.desc.example.headertext} + ': '"></small>
<small style="display: inline-block;" class="form-text text-muted" th:text="#{book.desc.example.year}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.year')} ?: 'book.desc.set.year'">
book.desc.set.year
</small>
<small style="display: inline-block;" class="form-text text-info"
th:text="(${#messages.msgOrNull('book.desc.example.headertext')} ?: 'book.desc.example.headertext') + ': '">
book.desc.example.headertext:
</small>
<small style="display: inline-block;" class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.example.year')} ?: 'book.desc.example.year'">
book.desc.example.year
</small>
<div class="alert alert-danger mt-2" th:if="${#fields.hasErrors('year')}"
th:errors="*{year}">Invalid year</div>
th:errors="*{year}">Invalid year value</div>
</div>
<div class="form-group bookform-section">
<label for="fname" th:text="#{book.price}"></label>
<label for="fname"
th:text="${#messages.msgOrNull('book.price')} ?: 'book.price'">
book.price
</label>
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text" th:text="#{page.symbols.currency}"></div>
<div class="input-group-text"
th:text="${#messages.msgOrNull('page.symbols.currency')} ?: 'page.symbols.currency'">
page.symbols.currency
</div>
</div>
<input class="form-control" type="text" th:field="*{price}" placeholder="Book price"/>
</div>
<small class="form-text text-muted" th:text="#{book.desc.set.price}"></small>
<small style="display: inline-block;" class="form-text text-info" th:text="#{book.desc.example.headertext} + ': '"></small>
<small style="display: inline-block;" class="form-text text-muted" th:text="#{book.desc.example.price}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.price')} ?: 'book.desc.set.price'">
book.desc.set.price
</small>
<small style="display: inline-block;" class="form-text text-info"
th:text="(${#messages.msgOrNull('book.desc.example.headertext')} ?: 'book.desc.example.headertext') + ': '">
book.desc.example.headertext:
</small>
<small style="display: inline-block;" class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.example.price')} ?: 'book.desc.example.price'">
book.desc.example.price
</small>
<div class="alert alert-danger mt-2" th:if="${#fields.hasErrors('price')}"
th:errors="*{price}">Invalid price</div>
th:errors="*{price}">Invalid price value</div>
</div>
<div class="form-group bookform-section">
<label for="BookCategory">Category</label>
<select class="form-control" th:field="*{category}" th:selected="${book.category}">
<label for="BookCategory"
th:text="${#messages.msgOrNull('book.category')} ?: 'book.category'">
book.category
</label>
<select class="form-control" th:field="*{category}" th:selected="*{category}">
<option
th:each="category : ${categories}"
th:value="${category.getId()}"
th:text="${category.getName()}"
></option>
th:value="${category.id}"
th:text="${category.name}"
>(obj) category.name</option>
</select>
<small class="form-text text-muted" th:text="#{book.desc.set.category}"></small>
<small class="form-text text-muted"
th:text="${#messages.msgOrNull('book.desc.set.category')} ?: 'book.desc.set.category'">
book.desc.set.category
</small>
</div>
<button class="btn btn-primary" type="submit" th:text="#{button.book.edit}"></button>
<button class="btn btn-primary" type="submit"
th:text="${#messages.msgOrNull('button.book.edit')} ?: 'button.book.edit'">
button.book.edit
</button>
</form>
<br>
<form action="#" th:action="@{../__${listpage}__}" method="get">
<button class="btn btn-success" type="submit" th:text="#{button.page.list.return}"></button>
<button class="btn btn-success" type="submit"
th:text="${#messages.msgOrNull('button.page.list.return')} ?: 'button.page.list.return'">
button.page.list.return
</button>
</form>
</div>


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

@ -2,41 +2,69 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" rel="stylesheet" th:href="@{../css/bookstore.css}" />
<link type="text/css" rel="stylesheet" th:href="@{css/bootstrap.min.css}" />
<title th:text="#{page.title.browser.list}"></title>
<link type="text/css" rel="stylesheet" href="../static/css/bookstore.css" th:href="@{../css/bookstore.css}" />
<link type="text/css" rel="stylesheet" href="../static/css/bootstrap.min.css" th:href="@{../css/bootstrap.min.css}" />
<title th:text="${#messages.msgOrNull('page.title.browser.list')} ?: 'page.title.browser.list'">
page.title.browser.list
</title>
</head>
<body>
<div>
<h1 th:text="#{page.title.webform.list}"></h1>
<h1 th:text="${#messages.msgOrNull('page.title.webform.list')} ?: 'page.title.webform.list'">
page.title.webform.list
</h1>
<table class="table table-striped">
<tr>
<th th:text="#{book.author}"></th>
<th th:text="#{book.title}"></th>
<th th:text="#{book.isbn}"></th>
<th th:text="#{book.year}"></th>
<th th:text="#{book.category}"></th>
<th th:text="#{book.price}"></th>
<th th:text="#{page.text.list.actions}"></th>
<th th:text="${#messages.msgOrNull('book.author')} ?: 'book.author'">book.author</th>
<th th:text="${#messages.msgOrNull('book.title')} ?: 'book.title'">book.title</th>
<th th:text="${#messages.msgOrNull('book.isbn')} ?: 'book.isbn'">book.isbn</th>
<th th:text="${#messages.msgOrNull('book.year')} ?: 'book.year'">book.year</th>
<th th:text="${#messages.msgOrNull('book.category')} ?: 'book.category'">book.category</th>
<th th:text="${#messages.msgOrNull('book.price')} ?: 'book.price'">book.price</th>
<th th:text="${#messages.msgOrNull('page.text.list.actions')} ?: 'page.text.list.actions'">page.text.list.actions</th>
<th></th>
</tr>
<tr th:each="book : ${books}">
<td th:text="${book.author}"></td>
<td th:text="${book.title}"></td>
<td th:text="${book.isbn}"></td>
<td th:text="${book.year}"></td>
<td th:text="${book.category.getName()}"></td>
<td th:text="${#numbers.formatDecimal(book.price, 1, 2)}+ ' ' + #{page.symbols.currency}"></td>
<td><a class="btn btn-danger"
th:attr="onclick='javascript:return confirm(\'' + 'Delete book: ' + ${book.title} + '?' + '\');'"
th:href="@{__${deletepage}__/{id}(id=${book.id})}" th:text="#{page.text.list.delete}"></a></td>
<td><a class="btn btn-warning"
th:href="@{__${editpage}__/{id}(id=${book.id})}" th:text="#{page.text.list.edit}"></a></td>
<td th:text="${book.author}">(obj) book.author</td>
<td th:text="${book.title}">(obj) book.title</td>
<td th:text="${book.isbn}">(obj) book.isbn</td>
<td th:text="${book.year}">(obj) book.year</td>
<td th:text="${book.category.name}">(obj) book.category.name</td>
<td th:text="(${#numbers.formatDecimal(book.price, 1, 2)} ?: '0.00') + ' ' + (${#messages.msgOrNull('page.symbols.currency')} ?: 'page.symbols.currency')">
0.00 page.symbols.currency
</td>
<td>
<a class="btn btn-danger"
th:attr="onclick='javascript:return confirm(\'' + 'Delete book: ' + ${book.title} + '?' + '\');'"
th:href="@{__${deletepage}__/{id}(id=${book.id})}"
th:text="${#messages.msgOrNull('page.text.list.delete')} ?: 'page.text.list.delete'">
page.text.list.delete
</a>
</td>
<td>
<a class="btn btn-warning"
th:href="@{__${editpage}__/{id}(id=${book.id})}"
th:text="${#messages.msgOrNull('page.text.list.edit')} ?: 'page.text.list.edit'">
page.text.list.edit
</a>
</td>
</tr>
</table>
<div>
<a class="btn btn-success" th:href="@{__${addpage}__}" th:text="#{button.book.add}"></a>
<a class="btn btn-success" th:href="@{__${addpage}__}"
th:text="${#messages.msgOrNull('button.book.add')} ?: 'button.book.add'">
button.book.add
</a>
</div>
</div>
</body>


Loading…
Cancel
Save