Skip to content

Commit

Permalink
simplify writePage
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Sep 26, 2020
1 parent a2fc42f commit 920abd1
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,20 +384,16 @@ func saveOAuth2Info(w http.ResponseWriter, r *http.Request, provider string, id
}

func writePage(r *http.Request, w http.ResponseWriter, user *User, hbs string, page string, title string, data map[string]interface{}) {
etc.WriteHandlebarsFile(r, w, "/_header.hbs", map[string]interface{}{
ctx := map[string]interface{}{
"version": Version,
"base": "/",
"user": user,
"page": page,
"title": title,
})
etc.WriteHandlebarsFile(r, w, F("/%s.hbs", hbs), map[string]interface{}{
"base": "/",
"user": user,
"page": page,
"title": title,
"data": data,
})
}
etc.WriteHandlebarsFile(r, w, "/_header.hbs", ctx)
ctx["data"] = data
etc.WriteHandlebarsFile(r, w, F("/%s.hbs", hbs), ctx)
}

func writeJson(w http.ResponseWriter, val interface{}) {
Expand Down

0 comments on commit 920abd1

Please sign in to comment.