本文整理匯總了Golang中github.com/cagnosolutions/web.Context.GetFlash方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.GetFlash方法的具體用法?Golang Context.GetFlash怎麽用?Golang Context.GetFlash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cagnosolutions/web.Context
的用法示例。
在下文中一共展示了Context.GetFlash方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: getLogin
func getLogin(w http.ResponseWriter, r *http.Request, c *web.Context) {
msgK, msgV := c.GetFlash()
ts.Render(w, "login.tmpl", tmpl.Model{
msgK: msgV,
})
return
}
示例2: AdminHome
// GET admin home
func AdminHome(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-home.tmpl", tmpl.Model{
msgK: msgV,
})
return
}
示例3: DevComments
func DevComments(w http.ResponseWriter, r *http.Request, c *web.Context) {
if !c.CheckAuth(w, r, "/login", "developer") {
return
}
msgK, msgV := c.GetFlash()
ts.Render(w, "dev-comments.tmpl", tmpl.Model{
msgK: msgV,
"comments": service.FindAllComment(),
})
}
示例4: getLogin
// GET get main login page
func getLogin(w http.ResponseWriter, r *http.Request, c *web.Context) {
msgK, msgV := c.GetFlash()
m := map[string]string{"key1": "val1", "key2": "val2"}
ts.Render(w, "login.tmpl", tmpl.Model{
msgK: msgV,
"m": m,
"keyToMap": "key1",
})
return
}
示例5: AdminCompanyVehicleNew
// GET admin get new vehicle page
func AdminCompanyVehicleNew(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-company-vehicle-form.tmpl", tmpl.Model{
msgK: msgV,
"vehicles": service.FindAllVehicleByCompany(c.GetPathVar("companyId")),
"company": service.FindOneCompany(c.GetPathVar("companyId")),
})
}
示例6: AdminCompanyNew
// GET admin new company page
func AdminCompanyNew(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-companies-form.tmpl", tmpl.Model{
msgK: msgV,
"companies": service.FindAllCompany(),
})
return
}
示例7: AdminVehicleGetAll
// GET admin get all vehicles
func AdminVehicleGetAll(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-vehicle.tmpl", tmpl.Model{
msgK: msgV,
"vehicles": service.FindAllVehicle(),
"companies": service.CompanyNames(),
})
return
}
示例8: AdminEmployeeNew
// GET admin new employee page
func AdminEmployeeNew(w http.ResponseWriter, r *http.Request, c *web.Context) {
if !c.CheckAuth(w, r, "/login", "admin", "developer") {
return
}
msgK, msgV := c.GetFlash()
ts.Render(w, "admin-employee-form.tmpl", tmpl.Model{
msgK: msgV,
"employees": service.FindAllEmployee(),
"users": service.UserRoles(),
})
return
}
示例9: AdminCompanyDriverGetAll
// GET admin get all company's drivers
func AdminCompanyDriverGetAll(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-company-driver.tmpl", tmpl.Model{
msgK: msgV,
"drivers": service.FindAllDriverByCompany(c.GetPathVar("companyId")),
"company": service.FindOneCompany(c.GetPathVar("companyId")),
})
return
}
示例10: companyRegister
// GET get company register page
func companyRegister(w http.ResponseWriter, r *http.Request, c *web.Context) {
company, ok := service.FindOneCompanyBySlug(c.GetPathVar("slug"))
if !ok || !company.Feature {
fmt.Fprintf(w, "404 Not Page Found")
return
}
msgK, msgV := c.GetFlash()
ts.Render(w, "company-register.tmpl", tmpl.Model{
msgK: msgV,
"company": company,
})
return
}
示例11: AdminDriverDocumentGetAll
func AdminDriverDocumentGetAll(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-document.tmpl", tmpl.Model{
msgK: msgV,
"driver": service.FindOneDriver(c.GetPathVar("driverId")),
"documents": service.FindAllDocumentByDriver(c.GetPathVar("driverId")),
"dqfs": service.DQFS,
})
return
}
示例12: AdminCompanyGetOne
// GET admin get company
func AdminCompanyGetOne(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-company.tmpl", tmpl.Model{
msgK: msgV,
"company": service.FindOneCompany(c.GetPathVar("id")),
"driverCount": service.GetDriverCount(c.GetPathVar("id")),
"vehicleCount": service.GetVehicleCount(c.GetPathVar("id")),
})
return
}
示例13: companyRegister
func companyRegister(w http.ResponseWriter, r *http.Request, c *web.Context) {
var company Company
if ok := GetCompBySlug(c.GetPathVar("slug"), &company); !ok || !company.Feature {
fmt.Fprintf(w, "404 Not Page Found")
return
}
msgK, msgV := c.GetFlash()
ts.Render(w, "company-register.tmpl", tmpl.Model{
msgK: msgV,
"company": company,
})
return
}
示例14: AdminDriverGetOne
// 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
}
示例15: getDriverHome
func getDriverHome(w http.ResponseWriter, r *http.Request, c *web.Context) {
if !c.CheckAuth(w, r, "/"+c.GetPathVar("slug"), "driver") {
return
}
if c.GetFromSession("slug") != c.GetPathVar("slug") {
http.Redirect(w, r, "/"+c.GetFromSession("slug").(string)+"/driver", 303)
}
msgK, msgV := c.GetFlash()
ts.Render(w, "driver-home.tmpl", tmpl.Model{
msgK: msgV,
"driver": service.FindOneDriver(c.GetFromSession("id").(string)),
"slug": c.GetPathVar("slug"),
"documents": service.FindAllIncompleteDocumentByDriver(c.GetFromSession("id").(string)),
})
return
}