本文整理匯總了Golang中github.com/zdebeer99/gojade.Engine類的典型用法代碼示例。如果您正苦於以下問題:Golang Engine類的具體用法?Golang Engine怎麽用?Golang Engine使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Engine類的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)
}