diff --git a/template/functions.go b/template/functions.go index d4ca80ed..b86b059e 100644 --- a/template/functions.go +++ b/template/functions.go @@ -75,7 +75,7 @@ func (f *funcMap) Map() template.FuncMap { "contains": func(str, substr string) bool { return strings.Contains(str, substr) }, - "replace": func(str, old string, new string) string { + "replace": func(str, old, new string) string { return strings.Replace(str, old, new, 1) }, "isodate": func(ts time.Time) string { @@ -86,7 +86,7 @@ func (f *funcMap) Map() template.FuncMap { }, "icon": func(iconName string) template.HTML { return template.HTML(fmt.Sprintf( - ``, + ``, route.Path(f.router, "appIcon", "filename", "sprite.svg"), iconName, )) diff --git a/template/templates/common/layout.html b/template/templates/common/layout.html index efdedbb5..eb171d6d 100644 --- a/template/templates/common/layout.html +++ b/template/templates/common/layout.html @@ -29,20 +29,17 @@ - {{ if .csrf }} - - {{ end }} - {{ if and .user .user.Stylesheet }} {{ end }} - - + + diff --git a/ui/static/js/request_builder.js b/ui/static/js/request_builder.js index 4a41f647..140d6bca 100644 --- a/ui/static/js/request_builder.js +++ b/ui/static/js/request_builder.js @@ -30,9 +30,9 @@ class RequestBuilder { } getCsrfToken() { - let element = document.querySelector("meta[name=X-CSRF-Token]"); + let element = document.querySelector("body[data-csrf-token"); if (element !== null) { - return element.getAttribute("value"); + return element.dataset.csrfToken; } return "";