Commit 7f8aff02 authored by Phillip Webb's avatar Phillip Webb

Format HTML in web-ui sample

parent 2f84cdc7
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"> <html xmlns:th="http://www.thymeleaf.org"
<head> xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<title>Layout</title> <head>
<link rel="stylesheet" <title>Layout</title>
th:href="@{/css/bootstrap.min.css}" <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}"
href="../../css/bootstrap.min.css"/> href="../../css/bootstrap.min.css" />
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<div class="navbar"> <div class="navbar">
<div class="navbar-inner"> <div class="navbar-inner">
<a class="brand" <a class="brand"
href="https://github.com/ultraq/thymeleaf-layout-dialect"> href="https://github.com/ultraq/thymeleaf-layout-dialect">
Thymeleaf - Layout Thymeleaf - Layout </a>
</a>
<ul class="nav"> <ul class="nav">
<li> <li><a th:href="@{/}" href="messages.html"> Messages </a></li>
<a th:href="@{/}" href="messages.html">
Messages
</a>
</li>
</ul> </ul>
</div> </div>
</div> </div>
<h1 layout:fragment="header">Layout</h1> <h1 layout:fragment="header">Layout</h1>
<div layout:fragment="content"> <div layout:fragment="content">Fake content</div>
Fake content
</div> </div>
</div> </body>
</body>
</html> </html>
...@@ -2,46 +2,33 @@ ...@@ -2,46 +2,33 @@
<html xmlns:th="http://www.thymeleaf.org" <html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
layout:decorator="layout"> layout:decorator="layout">
<head> <head>
<title>Messages : Create</title> <title>Messages : Create</title>
</head> </head>
<body> <body>
<h1 layout:fragment="header">Messages : Create</h1> <h1 layout:fragment="header">Messages : Create</h1>
<div layout:fragment="content" <div layout:fragment="content" class="container">
class="container"> <form id="messageForm" th:action="@{/(form)}" th:object="${message}"
<form id="messageForm" action="#" method="post">
th:action="@{/(form)}" <div th:if="${#fields.hasErrors('*')}" class="alert alert-error">
th:object="${message}" <p th:each="error : ${#fields.errors('*')}" th:text="${error}">
action="#" Validation error</p>
method="post">
<div th:if="${#fields.hasErrors('*')}"
class="alert alert-error">
<p th:each="error : ${#fields.errors('*')}"
th:text="${error}">
Validation error
</p>
</div> </div>
<div class="pull-right"> <div class="pull-right">
<a th:href="@{/}" href="messages.html"> <a th:href="@{/}" href="messages.html"> Messages </a>
Messages
</a>
</div> </div>
<input type="hidden" <input type="hidden" th:field="*{id}"
th:field="*{id}" th:class="${#fields.hasErrors('id')} ? 'field-error'" /> <label
th:class="${#fields.hasErrors('id')} ? 'field-error'" for="summary">Summary</label> <input type="text"
/>
<label for="summary">Summary</label>
<input type="text"
th:field="*{summary}" th:field="*{summary}"
th:class="${#fields.hasErrors('summary')} ? 'field-error'"/> th:class="${#fields.hasErrors('summary')} ? 'field-error'" /> <label
<label for="text">Message</label> for="text">Message</label>
<textarea <textarea th:field="*{text}"
th:field="*{text}"
th:class="${#fields.hasErrors('text')} ? 'field-error'"></textarea> th:class="${#fields.hasErrors('text')} ? 'field-error'"></textarea>
<div class="form-actions"> <div class="form-actions">
<input type="submit" value="Save"/> <input type="submit" value="Save" />
</div> </div>
</form> </form>
</div> </div>
</body> </body>
</html> </html>
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<html xmlns:th="http://www.thymeleaf.org" <html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
layout:decorator="layout"> layout:decorator="layout">
<head> <head>
<title>Messages : View all</title> <title>Messages : View all</title>
</head> </head>
<body> <body>
<h1 layout:fragment="header">Messages : View all</h1> <h1 layout:fragment="header">Messages : View all</h1>
<div layout:fragment="content" class="container"> <div layout:fragment="content" class="container">
<div class="pull-right"> <div class="pull-right">
...@@ -21,25 +21,17 @@ ...@@ -21,25 +21,17 @@
</thead> </thead>
<tbody> <tbody>
<tr th:if="${messages.empty}"> <tr th:if="${messages.empty}">
<td colspan="3"> <td colspan="3">No messages</td>
No messages
</td>
</tr> </tr>
<tr th:each="message : ${messages}"> <tr th:each="message : ${messages}">
<td th:text="${message.id}">1</td> <td th:text="${message.id}">1</td>
<td th:text="${#calendars.format(message.created)}"> <td th:text="${#calendars.format(message.created)}">July 11,
July 11, 2012 2:17:16 PM CDT 2012 2:17:16 PM CDT</td>
</td> <td><a href="view.html" th:href="@{'/' + ${message.id}}"
<td> th:text="${message.summary}"> The summary </a></td>
<a href="view.html"
th:href="@{'/' + ${message.id}}"
th:text="${message.summary}">
The summary
</a>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</body> </body>
</html> </html>
<html xmlns:th="http://www.thymeleaf.org" <html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
layout:decorator="layout"> layout:decorator="layout">
<head> <head>
<title>Messages : View</title> <title>Messages : View</title>
</head> </head>
<body> <body>
<h1 layout:fragment="header">Messages : Create</h1> <h1 layout:fragment="header">Messages : Create</h1>
<div layout:fragment="content" <div layout:fragment="content" class="container">
class="container"> <div class="alert alert-success" th:if="${globalMessage}"
<div class="alert alert-success" th:text="${globalMessage}">Some Success message</div>
th:if="${globalMessage}"
th:text="${globalMessage}">
Some Success message
</div>
<div class="pull-right"> <div class="pull-right">
<a th:href="@{/}" href="list.html"> <a th:href="@{/}" href="list.html"> Messages </a>
Messages
</a>
</div> </div>
<dl> <dl>
<dt>ID</dt> <dt>ID</dt>
<dd id="id" th:text="${message.id}">123</dd> <dd id="id" th:text="${message.id}">123</dd>
<dt>Date</dt> <dt>Date</dt>
<dd id="created" <dd id="created" th:text="${#calendars.format(message.created)}">
th:text="${#calendars.format(message.created)}"> July 11, 2012 2:17:16 PM CDT</dd>
July 11, 2012 2:17:16 PM CDT
</dd>
<dt>Summary</dt> <dt>Summary</dt>
<dd id="summary" <dd id="summary" th:text="${message.summary}">A short summary...
th:text="${message.summary}">
A short summary...
</dd> </dd>
<dt>Message</dt> <dt>Message</dt>
<dd id="text" <dd id="text" th:text="${message.text}">A detailed message that
th:text="${message.text}"> is longer than the summary.</dd>
A detailed message that is longer than the summary.
</dd>
</dl> </dl>
<div class="pull-left"> <div class="pull-left">
<a href="messages" <a href="messages" th:href="@{'/delete/' + ${message.id}}">
th:href="@{'/delete/' + ${message.id}}"> delete </a> | <a href="form.html"
delete th:href="@{'/modify/' + ${message.id}}"> modify </a>
</a>
|
<a href="form.html"
th:href="@{'/modify/' + ${message.id}}">
modify
</a>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment