refactor: data structs for template + method

enclosing rooms.Room into roomTableData, with methods to be used in
tempalte to get other template related derived data structures
This commit is contained in:
efim
2023-11-19 05:41:03 +00:00
parent 8b23103e8e
commit e4c56506be
3 changed files with 35 additions and 37 deletions

View File

@@ -65,13 +65,14 @@
{{end}}
<h2>Now for a person</h2>
<p>expected to be called with personData</p>
{{ define "personBlocks" }}
<div class="person-bricks "
id="person-{{.Index}}"
style="--i: {{ .Index }}"
>
{{ range (bricksForPerson .) }}
{{ range .BricksForPerson }}
{{ template "brick" . }}
{{ end }}
<p>{{ .Name }}</p>
@@ -81,8 +82,8 @@
<h2>And now i'll want to get all persons for a room</h2>
<p>expected be called with room *roomTableData</p>
{{ define "roomPeople" }}
{{ with (personsFromRoom .)}}
<div
class="circle-container relative"
style="--tan: {{ .Tangens }}; --m: {{ .Total }};"
@@ -91,5 +92,4 @@
{{ template "personBlocks" . }}
{{ end }}
</div>
{{ end }}
{{end}}