WIP
[demos/spring-boot] / src / main / resources / templates / form.html
diff --git a/src/main/resources/templates/form.html b/src/main/resources/templates/form.html
new file mode 100644 (file)
index 0000000..586a812
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html lang="en" xmlns:th="http://www.thymeleaf.org">
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <title>Demo: Multidimensional Map With Dynamic Binding</title>
+    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
+  </head>
+  <body>
+    <nav class="navbar navbar-dark bg-primary navbar-expand navbar-dark flex-column">
+      <h2 class="navbar-brand">Demo: Multidimensional Map With Dynamic Binding</h2>
+    </nav>
+    <main class="container mt-5">
+      <form action="#" th:action="@{/}" th:object="${form}" method="get">
+        <div class="card" th:each="card : *{cards.rowSet()}">
+          <div class="card-header"><h1 th:text="|Card #${card.key}|">Card #X</h1></div>
+          <div class="card-body">
+            <div class="card-text">
+              <div class="form-group" th:each="row : ${card.value.rowSet()}">
+                <input type="checkbox" id="x" class="form-control" th:field="*{cards[__${card.key}__][__${row.key}__]}" />
+                <label for="x" th:for="${#ids.prev('cards[__${card.key}__][__${row.key}__]')}" th:text="${row.value}">ROW_NAME</label>
+                <button type="submit" name="removeRow" class="btn btn-primary" th:value="|${card.key}:${row.key}|">Remove</button>
+              </div>
+              <button type="submit" name="add" value="row" class="btn btn-primary">Add Row</button>
+            </div>
+            <div class="card-footer">
+              <button type="submit" name="remove" value="card" class="btn btn-primary">Remove Card</button>
+            </div>
+          </div>
+        </div>
+        <button type="submit" name="add" value="card" class="btn btn-primary">Add Card</button>
+      </form>
+    </main>
+  </body>
+</html>