summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorGrailFinder <wohilas@gmail.com>2024-03-23 16:39:52 +0300
committerGrailFinder <wohilas@gmail.com>2024-03-23 16:39:52 +0300
commit4ea04ef5b382b147d789240ef78dc24bd142df95 (patch)
treef2d61824aefae9a87312d4a73874701e10d1b9c4 /components
parent87d71e65ed131b3e15510af968dd5ba0d30d851d (diff)
Enha: demonstraton of layouts
Diffstat (limited to 'components')
-rw-r--r--components/actions_table.html42
-rw-r--r--components/index.html33
2 files changed, 60 insertions, 15 deletions
diff --git a/components/actions_table.html b/components/actions_table.html
new file mode 100644
index 0000000..0e9ecc1
--- /dev/null
+++ b/components/actions_table.html
@@ -0,0 +1,42 @@
+{{define "UserScore"}}
+<table>
+ <tr>
+ <th>ID</th>
+ <th>BurnTime</th>
+ <th>Score</th>
+ </tr>
+ <tr>
+ <td>{{.ID}}</td>
+ <td>{{.BurnTime}}</td>
+ <td>{{.Score}}</td>
+ </tr>
+</table>
+<table>
+ <tr>
+ <th>ActionTypePlus</th>
+ </tr>
+ {{range $action := .Actions}}
+ {{if eq $action.Type "ActionTypePlus"}}
+ <tr>
+ <td>{{$action.Name}}</td>
+ <td>{{$action.Magnitude}}</td>
+ <td>{{$action.Repeatable}}</td>
+ </tr>
+ {{end}}
+ {{end}}
+</table>
+<table>
+ <tr>
+ <th>ActionTypeMinus</th>
+ </tr>
+ {{range $action := .Actions}}
+ {{if eq $action.Type "ActionTypeMinus"}}
+ <tr>
+ <td>{{$action.Name}}</td>
+ <td>{{$action.Magnitude}}</td>
+ <td>{{$action.Repeatable}}</td>
+ </tr>
+ {{end}}
+ {{end}}
+</table>
+{{end}}
diff --git a/components/index.html b/components/index.html
index 7c4cb82..d32154a 100644
--- a/components/index.html
+++ b/components/index.html
@@ -1,3 +1,4 @@
+{{define "main"}}
<!DOCTYPE html>
<html>
<head>
@@ -12,20 +13,21 @@
<div>
HELLO {{.ID}}
<br />
- You have {{len .Actions}} actions.
- <br />
- Your current score: {{.Score}}
- <br />
- {{ range .Actions }}
- Action Name: {{.Name}}
- <br />
- Action Magnitude: {{.Magnitude}}
- <br />
- Action Type: {{.Type}}
- <br />
- Repeatable: {{.Repeatable}}
- <br />
- {{end}}
+ <!-- You have {{len .Actions}} actions. -->
+ <!-- <br /> -->
+ <!-- Your current score: {{.Score}} -->
+ <!-- <br /> -->
+ <!-- {{ range .Actions }} -->
+ <!-- Action Name: {{.Name}} -->
+ <!-- <br /> -->
+ <!-- Action Magnitude: {{.Magnitude}} -->
+ <!-- <br /> -->
+ <!-- Action Type: {{.Type}} -->
+ <!-- <br /> -->
+ <!-- Repeatable: {{.Repeatable}} -->
+ <!-- <br /> -->
+ <!-- {{end}} -->
+ {{ template "UserScore" . }}
</div>
<div>
@@ -34,7 +36,7 @@
<label>Name:</label><br />
<input type="text" name="name"><br />
<label>Magnitude:</label><br />
- <input type="number" default="1" name="magnitude"><br />
+ <input type="number" value="1" name="magnitude"><br />
<label>Repeatable:</label><br />
<input type="checkbox" name="repeatable"></input><br />
<input type="radio" name="act_type" value="plus" checked>
@@ -47,3 +49,4 @@
</div>
</body>
</html>
+{{end}}