debug json config
This commit is contained in:
parent
6380871358
commit
f891b0288b
|
@ -37,6 +37,7 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server.DebugJSON = config.DebugJSON
|
||||||
templates.DebugTemplates = config.DebugTemplates
|
templates.DebugTemplates = config.DebugTemplates
|
||||||
|
|
||||||
var world *model.DfWorld
|
var world *model.DfWorld
|
||||||
|
|
|
@ -13,6 +13,7 @@ type Config struct {
|
||||||
LastPath string
|
LastPath string
|
||||||
LastFile string
|
LastFile string
|
||||||
DebugTemplates bool `json:"DebugTemplates,omitempty"`
|
DebugTemplates bool `json:"DebugTemplates,omitempty"`
|
||||||
|
DebugJSON bool `json:"DebugJSON,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadConfig(path string) (*Config, error) {
|
func LoadConfig(path string) (*Config, error) {
|
||||||
|
|
|
@ -12,9 +12,17 @@ import (
|
||||||
"github.com/robertjanetzko/LegendsBrowser2/backend/util"
|
"github.com/robertjanetzko/LegendsBrowser2/backend/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var DebugJSON = false
|
||||||
|
|
||||||
func (srv *DfServer) LoadTemplates() {
|
func (srv *DfServer) LoadTemplates() {
|
||||||
functions := template.FuncMap{
|
functions := template.FuncMap{
|
||||||
"json": util.Json,
|
"json": func(obj any) template.HTML {
|
||||||
|
if !DebugJSON {
|
||||||
|
return ""
|
||||||
|
} else {
|
||||||
|
return util.Json(obj)
|
||||||
|
}
|
||||||
|
},
|
||||||
"check": func(condition bool, v any) any {
|
"check": func(condition bool, v any) any {
|
||||||
if condition {
|
if condition {
|
||||||
return v
|
return v
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<ul class="mb-0">
|
<ul class="mb-0">
|
||||||
{{- range $event := .Events }}
|
{{- range $event := .Events }}
|
||||||
<li>
|
<li data-event-id="{{ $event.Id }}">
|
||||||
[{{ $event.Id }}] In {{ time $event.Year $event.Seconds72 }},
|
In {{ time $event.Year $event.Seconds72 }},
|
||||||
{{ html ($event.Details.Html ($.Context.WithEvent $event)) }}
|
{{ html ($event.Details.Html ($.Context.WithEvent $event)) }}
|
||||||
{{ if ne .Collection -1 }} <a class="collection" href="/collection/{{.Collection}}"><i
|
{{ if ne .Collection -1 }} <a class="collection" href="/collection/{{.Collection}}"><i
|
||||||
class="fa-solid fa-magnifying-glass fa-xs"></i></a>{{end}}
|
class="fa-solid fa-magnifying-glass fa-xs"></i></a>{{end}}
|
||||||
|
|
Loading…
Reference in New Issue