コード例 #1
0
ファイル: admin-controllers.go プロジェクト: gregpechiro/cns
// GET admin get all drivers
func AdminDriverGetAll(w http.ResponseWriter, r *http.Request, c *web.Context) {
	if !c.CheckAuth(w, r, "/login", "admin", "employee", "developer") {
		return
	}
	msgK, msgV := c.GetFlash()
	ts.Render(w, "admin-driver.tmpl", tmpl.Model{
		msgK:        msgV,
		"drivers":   service.FindAllDriver(),
		"companies": service.CompanyNames(),
	})
	return
}
コード例 #2
0
ファイル: admin-controllers.go プロジェクト: gregpechiro/cns
// GET admin get driver
func AdminDriverGetOne(w http.ResponseWriter, r *http.Request, c *web.Context) {
	if !c.CheckAuth(w, r, "/login", "admin", "employee", "developer") {
		return
	}
	msgK, msgV := c.GetFlash()
	driver := service.FindOneDriver(c.GetPathVar("id"))
	ts.Render(w, "admin-driver-form.tmpl", tmpl.Model{
		msgK:        msgV,
		"driver":    driver,
		"drivers":   service.FindAllDriver(),
		"companies": service.CompanyNames(),
		"user":      service.FindOneUser(driver.UserId),
	})
	return
}