Web UI corrections

This commit is contained in:
da
2017-02-02 17:52:09 +01:00
parent 8b2a052422
commit 4003fc212e
3 changed files with 11 additions and 15 deletions
+1 -1
View File
@@ -1 +1 @@
<div class="col-sm-3 text-center"><div class="sounditem" style="background-image: linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0.8)), url(/static/img/{{ .Itemprefix }}.jpg); background-size: 100%;"><div data-toggle="tooltip" data-placement="top" title="{{ .Itemtext }}">{{ .Itemcommand }} {{ .Itemsoundname }}<br/>{{ .Itemshorttext }}<br/><a class="btn btn-primary" href="javascript:playSound('{{ .Itemcommand }}', '{{ .Itemsoundname }}')" role="button">Play!</a><br/></div></div></div>
<div class="col-sm-3 text-center"><div class="sounditem"><div data-toggle="tooltip" data-placement="top" title="{{ .Itemtext }}">{{ .Itemcommand }} {{ .Itemsoundname }}<br/>{{ .Itemshorttext }}<br/><a class="btn btn-primary" href="javascript:playSound('{{ .Itemcommand }}', '{{ .Itemsoundname }}')" role="button">Play!</a><br/></div></div></div>
+9 -13
View File
@@ -142,15 +142,21 @@ func handleMain(w http.ResponseWriter, r *http.Request) {
}
var currentPrefix string = ""
var prefixChanged bool = false
for i, snd := range si {
var i int = 0
for _, snd := range si {
if snd.Itemprefix != currentPrefix {
if i != 0 {
err = tmpls["itemrowend.html"].Execute(w, nil)
if err != nil {
fmt.Println(err)
return
}
err = tmpls["collwrapend.html"].Execute(w, nil)
if err != nil {
fmt.Println(err)
return
}
i = 0
}
err = tmpls["collwrapstart.html"].Execute(w, snd)
if err != nil {
@@ -158,9 +164,6 @@ func handleMain(w http.ResponseWriter, r *http.Request) {
return
}
currentPrefix = snd.Itemprefix
if i != 0 {
prefixChanged = true
}
}
if i%4 == 0 {
err = tmpls["itemrowstart.html"].Execute(w, nil)
@@ -181,14 +184,7 @@ func handleMain(w http.ResponseWriter, r *http.Request) {
return
}
}
if prefixChanged {
err = tmpls["collwrapend.html"].Execute(w, nil)
if err != nil {
fmt.Println(err)
return
}
prefixChanged = false
}
i++
}
err = tmpls["internal.html"].ExecuteTemplate(w, "footer", map[string]interface{}{})