本文整理汇总了Golang中github.com/salviati/tattoo/webapp.Context.Execute方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.Execute方法的具体用法?Golang Context.Execute怎么用?Golang Context.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/salviati/tattoo/webapp.Context
的用法示例。
在下文中一共展示了Context.Execute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: RenderWriterEditor
func RenderWriterEditor(ctx *webapp.Context, article *Article) error {
vars := make(map[string]interface{})
vars["Article"] = article
data := MakeData(ctx, vars)
data.Flags.WriterEditor = true
err := ctx.Execute(editorTPL, &data)
return err
}
示例2: RenderWriterSettings
func RenderWriterSettings(ctx *webapp.Context, msg string) error {
vars := make(map[string]interface{})
vars["Message"] = msg
data := MakeData(ctx, vars)
data.Flags.WriterSettings = true
err := ctx.Execute(writerTPL, &data)
return err
}
示例3: RenderSinglePage
func RenderSinglePage(ctx *webapp.Context, name string, lastMeta *CommentMetadata) error {
vars := make(map[string]interface{})
vars["Name"] = name
vars["LastCommentMeta"] = lastMeta
data := MakeData(ctx, vars)
data.Flags.Single = true
err := ctx.Execute(mainTPL, &data)
return err
}
示例4: RenderFeedAtom
func RenderFeedAtom(ctx *webapp.Context) error {
vars := make(map[string]interface{})
vars["Declaration"] = template.HTML("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
data := MakeData(ctx, vars)
data.Flags.Feed = true
ctx.SetHeader("Content-Type", "application/atom+xml")
err := ctx.Execute(feedTPL, &data)
return err
}
示例5: RenderGuard
func RenderGuard(ctx *webapp.Context, hint string) error {
vars := make(map[string]interface{})
vars["Error"] = ""
if len(hint) != 0 {
vars["Error"] = hint
}
data := MakeData(ctx, vars)
err := ctx.Execute(guardTPL, &data)
return err
}
示例6: Render404page
func Render404page(ctx *webapp.Context, msg string) error {
if notFoundTPL != nil {
vars := make(map[string]interface{})
vars["Message"] = msg
vars["URL"] = ctx.Request.RequestURI
vars["Referer"] = ctx.Request.Referer()
data := MakeData(ctx, vars)
err := ctx.Execute(notFoundTPL, &data)
return err
} else {
ctx.Error(fmt.Sprintf("%s: %s", webapp.ErrNotFound, msg),
http.StatusNotFound)
return nil
}
return nil
}
示例7: RenderWriterComments
func RenderWriterComments(ctx *webapp.Context, offset int) error {
vars := make(map[string]interface{})
vars["Offset"] = offset
vars["AtBegin"] = false
vars["AtEnd"] = false
vars["Offset"] = offset
if TattooDB.GetCommentCount()-1-offset < 20 {
vars["AtEnd"] = true
}
if offset < 20 {
vars["AtBegin"] = true
}
data := MakeData(ctx, vars)
data.Flags.WriterComments = true
err := ctx.Execute(writerTPL, &data)
return err
}
示例8: RenderHomePage
func RenderHomePage(ctx *webapp.Context, offset int) error {
vars := make(map[string]interface{})
vars["Offset"] = offset
vars["AtBegin"] = false
vars["AtEnd"] = false
vars["Offset"] = offset
if TattooDB.GetArticleCount()-1-offset < GetConfig().TimelineCount {
vars["AtEnd"] = true
}
if offset < GetConfig().TimelineCount {
vars["AtBegin"] = true
}
data := MakeData(ctx, vars)
data.Flags.Home = true
err := ctx.Execute(mainTPL, &data)
return err
}
示例9: RenderTagPage
func RenderTagPage(ctx *webapp.Context, offset int, tag string) error {
vars := make(map[string]interface{})
tag = strings.Trim(tag, " ")
if !TattooDB.HasTag(tag) {
return errors.New(webapp.ErrNotFound)
}
vars["Offset"] = offset
vars["Tag"] = tag
vars["AtBegin"] = false
vars["AtEnd"] = false
if TattooDB.GetTagArticleCount(tag)-1-offset < GetConfig().TimelineCount {
vars["AtEnd"] = true
}
if offset < GetConfig().TimelineCount {
vars["AtBegin"] = true
}
data := MakeData(ctx, vars)
data.Flags.HasTag = true
err := ctx.Execute(mainTPL, &data)
return err
}