本文整理汇总了Golang中github.com/zdebeer99/gojade.Engine.RenderFileW方法的典型用法代码示例。如果您正苦于以下问题:Golang Engine.RenderFileW方法的具体用法?Golang Engine.RenderFileW怎么用?Golang Engine.RenderFileW使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/zdebeer99/gojade.Engine
的用法示例。
在下文中一共展示了Engine.RenderFileW方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Classify
func Classify(rw http.ResponseWriter, jade *gojade.Engine, db *gorm.DB) {
cls := []models.Classify{}
db.Find(&cls)
data := &struct {
Data []models.Classify
}{
Data: cls,
}
jade.RenderFileW(rw, "class", data)
}
示例2: Create
func Create(rw http.ResponseWriter, jade *gojade.Engine, db *gorm.DB) {
cls := []models.Classify{}
db.Find(&cls)
datas := &struct {
Cls []models.Classify
}{
Cls: cls,
}
jade.RenderFileW(rw, "create", datas)
}
示例3: Home
func Home(ad *fun.Admins, req *http.Request, res http.ResponseWriter, jade *gojade.Engine, db *gorm.DB) {
blogs := []models.Blog{}
db.Find(&blogs)
datas := &struct {
Title string
Is bool
Data []models.Blog
}{
Title: "首页",
Is: IsLogin(ad.Account, req),
Data: blogs,
}
jade.RenderFileW(res, "home", datas)
}
示例4: View
func View(ad *fun.Admins, params martini.Params, res http.ResponseWriter, req *http.Request, jade *gojade.Engine, db *gorm.DB) {
blog := &models.Blog{}
db.First(blog, params["id"])
if blog.Title != "" {
data := &struct {
B models.Blog
Is bool
}{
B: *blog,
Is: IsLogin(ad.Account, req),
}
jade.RenderFileW(res, "view", data)
} else {
jade.RenderFileW(res, "404", nil)
}
}
示例5: Tag
func Tag(ad *fun.Admins, req *http.Request, params martini.Params, res http.ResponseWriter, jade *gojade.Engine, db *gorm.DB) {
cs := models.Classify{}
tag := params["tag"]
db.Where("url=?", tag).First(&cs)
if cs.Title != "" {
blogs := []models.Blog{}
db.Where("cid=?", cs.ID).Find(&blogs)
data := &struct {
Cls models.Classify
Is bool
Data []models.Blog
}{
Cls: cs,
Is: IsLogin(ad.Account, req),
Data: blogs,
}
jade.RenderFileW(res, "tag", data)
} else {
jade.RenderFileW(res, "404", nil)
}
}
示例6: Edit
func Edit(params martini.Params, res http.ResponseWriter, jade *gojade.Engine, db *gorm.DB) {
blog := models.Blog{}
db.First(&blog, params["id"])
jade.RenderFileW(res, "edit", blog)
}
示例7: Login
func Login(res http.ResponseWriter, jade *gojade.Engine) {
jade.RenderFileW(res, "login", nil)
}
示例8: NotFound
func NotFound(rw http.ResponseWriter, jade *gojade.Engine) {
jade.RenderFileW(rw, "404", nil)
}