From 4f35cc959bb1a4d276b653b6dbd28fbeab5d6693 Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Fri, 26 May 2017 17:30:17 +0200 Subject: [PATCH] Lavoro su html --- html.go | 2 + template/Interfaccia.html | 112 ++++++++++++++++++++++++-------------- 2 files changed, 72 insertions(+), 42 deletions(-) diff --git a/html.go b/html.go index a0a2e1b..daf1169 100644 --- a/html.go +++ b/html.go @@ -19,6 +19,8 @@ func handlerRoot(w http.ResponseWriter, r *http.Request) { varmap := map[string]interface{}{ "matrice": Matrix, "tempoAggiorna": Clock, + "larghezza": Larghezza, + "altezza": Altezza, } templ.Execute(w, varmap) } diff --git a/template/Interfaccia.html b/template/Interfaccia.html index 8fe3176..aa42cf8 100644 --- a/template/Interfaccia.html +++ b/template/Interfaccia.html @@ -3,35 +3,45 @@ GoBug +

Go bug

-
- - {{range $riga := .matrice}} - - {{range $cella := $riga}} -
+
+ + {{range $riga := .matrice}} + + {{range $cella := $riga}} + + {{ if $cella.IsFood }} + class="cibo" + {{ else }} + class="razza1" + {{ end }} + {{ end }}>{{ $cella.Health }} + {{ end }} + {{ end }} - - {{ end }} -
{{ $cella }}
-
-
-
-

legenda

-
-

Food

-
-
-

Razza1

-
-
-

Razza2

+
- +
+

legenda

+
+
Cibo
+
+
Razza1
+
+
Razza2
+
+