1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-01-19 15:12:49 +00:00

Rename ExtraData to more appropriate BodyAttributes

This commit is contained in:
kez 2022-08-14 14:34:48 -07:00 committed by Timur Ismagilov
parent f3437d93c8
commit e0f2868d34
2 changed files with 17 additions and 17 deletions

View File

@ -15,7 +15,7 @@
<script src="/static/shortcuts.js"></script> <script src="/static/shortcuts.js"></script>
{{range .HeadElements}}{{.}}{{end}} {{range .HeadElements}}{{.}}{{end}}
</head> </head>
<body data-rrh-addr="{{if .Addr}}{{.Addr}}{{else}}{{.Meta.Addr}}{{end}}"{{range .ExtraData}} data-rrh-{{.}}=""{{end}}> <body data-rrh-addr="{{if .Addr}}{{.Addr}}{{else}}{{.Meta.Addr}}{{end}}"{{range .BodyAttributes}} data-rrh-{{.}}=""{{end}}>
<header> <header>
<nav class="main-width top-bar"> <nav class="main-width top-bar">
<ul class="top-bar__wrapper"> <ul class="top-bar__wrapper">

View File

@ -91,14 +91,14 @@ func localizedBaseWithWeirdBody(meta Meta) *template.Template {
} }
type BaseData struct { type BaseData struct {
Meta Meta Meta Meta
HeadElements []string HeadElements []string
HeaderLinks []HeaderLink HeaderLinks []HeaderLink
CommonScripts []string CommonScripts []string
Addr string Addr string
Title string // TODO: remove Title string // TODO: remove
Body string // TODO: remove Body string // TODO: remove
ExtraData []string BodyAttributes []string
} }
func (bd *BaseData) withBaseValues(meta Meta, headerLinks []HeaderLink, commonScripts []string) { func (bd *BaseData) withBaseValues(meta Meta, headerLinks []HeaderLink, commonScripts []string) {
@ -114,13 +114,13 @@ func Base(meta Meta, title, body string, extraData []string, headElements ...str
meta.W = &w meta.W = &w
t := localizedBaseWithWeirdBody(meta) t := localizedBaseWithWeirdBody(meta)
err := t.ExecuteTemplate(&w, "page", BaseData{ err := t.ExecuteTemplate(&w, "page", BaseData{
Meta: meta, Meta: meta,
Title: title, Title: title,
HeadElements: headElements, HeadElements: headElements,
HeaderLinks: HeaderLinks, HeaderLinks: HeaderLinks,
CommonScripts: cfg.CommonScripts, CommonScripts: cfg.CommonScripts,
Body: body, Body: body,
ExtraData: extraData, BodyAttributes: extraData,
}) })
if err != nil { if err != nil {
log.Println(err) log.Println(err)