reduce header tmpl size
avoid calling function twice in APIMe
This commit is contained in:
parent
28daeee702
commit
68c6b2f50a
|
@ -237,10 +237,11 @@ type MeSite struct {
|
||||||
// TODO: Decouple site settings into a different API? I'd like to avoid having too many requests, if possible, maybe we can use a different name for this?
|
// TODO: Decouple site settings into a different API? I'd like to avoid having too many requests, if possible, maybe we can use a different name for this?
|
||||||
func APIMe(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
|
func APIMe(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
|
||||||
// TODO: Don't make this too JSON dependent so that we can swap in newer more efficient formats
|
// TODO: Don't make this too JSON dependent so that we can swap in newer more efficient formats
|
||||||
w.Header().Set("Content-Type", "application/json")
|
h := w.Header()
|
||||||
|
h.Set("Content-Type", "application/json")
|
||||||
// We don't want an intermediary accidentally caching this
|
// We don't want an intermediary accidentally caching this
|
||||||
// TODO: Use this header anywhere with a user check?
|
// TODO: Use this header anywhere with a user check?
|
||||||
w.Header().Set("Cache-Control", "private")
|
h.Set("Cache-Control", "private")
|
||||||
|
|
||||||
me := JsonMe{(&user).Me(), MeSite{c.Site.MaxRequestSize}}
|
me := JsonMe{(&user).Me(), MeSite{c.Site.MaxRequestSize}}
|
||||||
jsonBytes, err := json.Marshal(me)
|
jsonBytes, err := json.Marshal(me)
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
{{range .Header.Stylesheets}}
|
{{range .Header.Stylesheets}}
|
||||||
<link href="/s/{{.}}" rel="stylesheet" type="text/css">{{end}}
|
<link href="/s/{{.}}" rel="stylesheet" type="text/css">{{end}}
|
||||||
{{range .Header.PreScriptsAsync}}
|
{{range .Header.PreScriptsAsync}}
|
||||||
<script async type="text/javascript" src="/s/{{.}}"></script>{{end}}
|
<script async src="/s/{{.}}"></script>{{end}}
|
||||||
<meta property="x-loggedin" content="{{.CurrentUser.Loggedin}}"/>
|
<meta property="x-loggedin" content="{{.CurrentUser.Loggedin}}"/>
|
||||||
<script type="text/javascript" src="/s/init.js?i=10"></script>
|
<script src="/s/init.js?i=10"></script>
|
||||||
{{range .Header.ScriptsAsync}}
|
{{range .Header.ScriptsAsync}}
|
||||||
<script async type="text/javascript" src="/s/{{.}}"></script>{{end}}
|
<script async src="/s/{{.}}"></script>{{end}}
|
||||||
<script type="text/javascript" src="/s/jquery-3.1.1.min.js"></script>
|
<script src="/s/jquery-3.1.1.min.js"></script>
|
||||||
{{range .Header.Scripts}}
|
{{range .Header.Scripts}}
|
||||||
<script type="text/javascript" src="/s/{{.}}"></script>{{end}}
|
<script src="/s/{{.}}"></script>{{end}}
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
|
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
|
||||||
{{if .Header.MetaDesc}}<meta name="description" content="{{.Header.MetaDesc}}"/>{{end}}
|
{{if .Header.MetaDesc}}<meta name="description" content="{{.Header.MetaDesc}}"/>{{end}}
|
||||||
{{/** TODO: Have page / forum / topic level tags and descriptions below as-well **/}}
|
{{/** TODO: Have page / forum / topic level tags and descriptions below as-well **/}}
|
||||||
|
@ -39,8 +39,7 @@
|
||||||
<li class="menu_left menu_hamburger" title="{{lang "menu_hamburger_tooltip"}}"><a></a></li>
|
<li class="menu_left menu_hamburger" title="{{lang "menu_hamburger_tooltip"}}"><a></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div><div style="clear:both;"></div>
|
||||||
<div style="clear:both;"></div>
|
|
||||||
</nav>
|
</nav>
|
||||||
<div class="right_of_nav">{{/**<!--{{dock "rightOfNav" .Header }}-->**/}}
|
<div class="right_of_nav">{{/**<!--{{dock "rightOfNav" .Header }}-->**/}}
|
||||||
{{/** TODO: Make this a separate template and load it via the theme docks, here for now so we can rapidly prototype the Nox theme **/}}
|
{{/** TODO: Make this a separate template and load it via the theme docks, here for now so we can rapidly prototype the Nox theme **/}}
|
||||||
|
|
Loading…
Reference in New Issue