Fix missing foil count in web view
This commit is contained in:
parent
4d0e75d806
commit
541a4bbd19
@ -3,6 +3,7 @@ package serra
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"text/template"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@ -16,6 +17,10 @@ func init() {
|
|||||||
rootCmd.AddCommand(webCmd)
|
rootCmd.AddCommand(webCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func add(a, b int64) int64 {
|
||||||
|
return a + b
|
||||||
|
}
|
||||||
|
|
||||||
var webCmd = &cobra.Command{
|
var webCmd = &cobra.Command{
|
||||||
Aliases: []string{"a"},
|
Aliases: []string{"a"},
|
||||||
Use: "web",
|
Use: "web",
|
||||||
@ -38,6 +43,9 @@ type Query struct {
|
|||||||
|
|
||||||
func startWeb() error {
|
func startWeb() error {
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
|
router.SetFuncMap(template.FuncMap{
|
||||||
|
"add": add,
|
||||||
|
})
|
||||||
router.LoadHTMLGlob("templates/*.tmpl")
|
router.LoadHTMLGlob("templates/*.tmpl")
|
||||||
router.Static("/assets", "./assets")
|
router.Static("/assets", "./assets")
|
||||||
|
|
||||||
|
|||||||
@ -168,7 +168,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{{range .cards}}
|
{{range .cards}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{.SerraCount}}</td>
|
<td>{{ add .SerraCount .SerraCountFoil }}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="cardpreview"><strong>{{.Name }}</strong>
|
<div class="cardpreview"><strong>{{.Name }}</strong>
|
||||||
<span class="cardpreviewtext">
|
<span class="cardpreviewtext">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user