WIP
[demos/spring-boot] / src / main / resources / templates / form.html
1 <!DOCTYPE html>
2 <html lang="en" xmlns:th="http://www.thymeleaf.org">
3   <head>
4     <meta charset="utf-8">
5     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6     <title>Demo: Multidimensional Map With Dynamic Binding</title>
7     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
8   </head>
9   <body>
10     <nav class="navbar navbar-dark bg-primary navbar-expand navbar-dark flex-column">
11       <h2 class="navbar-brand">Demo: Multidimensional Map With Dynamic Binding</h2>
12     </nav>
13     <main class="container mt-5">
14       <form action="#" th:action="@{/}" th:object="${form}" method="get">
15         <div class="card" th:each="card : *{cards.rowSet()}">
16           <div class="card-header"><h1 th:text="|Card #${card.key}|">Card #X</h1></div>
17           <div class="card-body">
18             <div class="card-text">
19               <div class="form-group" th:each="row : ${card.value.rowSet()}">
20                 <input type="checkbox" id="x" class="form-control" th:field="*{cards[__${card.key}__][__${row.key}__]}" />
21                 <label for="x" th:for="${#ids.prev('cards[__${card.key}__][__${row.key}__]')}" th:text="${row.value}">ROW_NAME</label>
22                 <button type="submit" name="removeRow" class="btn btn-primary" th:value="|${card.key}:${row.key}|">Remove</button>
23               </div>
24               <button type="submit" name="add" value="row" class="btn btn-primary">Add Row</button>
25             </div>
26             <div class="card-footer">
27               <button type="submit" name="remove" value="card" class="btn btn-primary">Remove Card</button>
28             </div>
29           </div>
30         </div>
31         <button type="submit" name="add" value="card" class="btn btn-primary">Add Card</button>
32       </form>
33     </main>
34   </body>
35 </html>