Ejemplo n.º 1
0
func GetHomePage(rw http.ResponseWriter, req *http.Request, _ httprouter.Params) {
	type Page struct {
		Title string
	}

	p := Page{
		Title: "user_home",
	}

	common.Templates = template.Must(template.ParseFiles("templates/user/home.html", common.LayoutPath))
	err := common.Templates.ExecuteTemplate(rw, "base", p)
	common.CheckError(err, 2)
}
Ejemplo n.º 2
0
func GetViewPage(rw http.ResponseWriter, req *http.Request, ps httprouter.Params) {
	type Page struct {
		Title  string
		UserId string
	}

	userId := ps.ByName("id")

	p := Page{
		Title:  "user_view",
		UserId: userId,
	}

	common.Templates = template.Must(template.ParseFiles("templates/user/view.html", common.LayoutPath))
	err := common.Templates.ExecuteTemplate(rw, "base", p)
	common.CheckError(err, 2)
}