本文整理匯總了Golang中github.com/Unknwon/orbiter/modules/context.Context.HTML方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.HTML方法的具體用法?Golang Context.HTML怎麽用?Golang Context.HTML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Unknwon/orbiter/modules/context.Context
的用法示例。
在下文中一共展示了Context.HTML方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ViewWebhook
func ViewWebhook(ctx *context.Context) {
ctx.Data["Title"] = "View Webhook"
ctx.Data["PageIsWebhook"] = true
ctx.Data["RequireHighlightJS"] = true
webhook, err := models.GetWebhookByID(ctx.ParamsInt64(":id"))
if err != nil {
if errors.IsWebhookNotFound(err) {
ctx.Handle(404, "GetWebhookByID", nil)
} else {
ctx.Handle(500, "GetWebhookByID", err)
}
return
}
ctx.Data["Webhook"] = webhook
// Prettify JSON in case it is not.
buf := new(bytes.Buffer)
if err = json.Indent(buf, []byte(webhook.Payload), "", " "); err != nil {
ctx.Handle(500, "json.Indent", err)
return
}
webhook.Payload = buf.String()
ctx.HTML(200, "webhook/view")
}
示例2: Dashboard
func Dashboard(ctx *context.Context) {
ctx.Data["Title"] = "Dashboard"
ctx.Data["PageIsDashboard"] = true
ctx.Data["NumWebhooks"] = models.CountWebhook()
ctx.HTML(200, "dashboard")
}
示例3: EditApplication
func EditApplication(ctx *context.Context) {
ctx.Data["Title"] = "Edit Application"
ctx.Data["PageIsApplication"] = true
parseApplicationByID(ctx)
if ctx.Written() {
return
}
ctx.HTML(200, "application/edit")
}
示例4: EditCollector
func EditCollector(ctx *context.Context) {
ctx.Data["Title"] = "Edit Collector"
ctx.Data["PageIsCollector"] = true
parseCollectorByID(ctx)
if ctx.Written() {
return
}
ctx.HTML(200, "collector/edit")
}
示例5: Applications
func Applications(ctx *context.Context) {
ctx.Data["Title"] = "Applications"
ctx.Data["PageIsApplication"] = true
apps, err := models.ListApplications()
if err != nil {
ctx.Handle(500, "ListApplications", err)
return
}
ctx.Data["Applications"] = apps
ctx.HTML(200, "application/list")
}
示例6: Collectors
func Collectors(ctx *context.Context) {
ctx.Data["Title"] = "Collectors"
ctx.Data["PageIsCollector"] = true
collectors, err := models.ListCollectors()
if err != nil {
ctx.Error(500, err.Error())
return
}
ctx.Data["Collectors"] = collectors
ctx.HTML(200, "collector/list")
}
示例7: Webhooks
func Webhooks(ctx *context.Context) {
ctx.Data["Title"] = "Webhooks"
ctx.Data["PageIsWebhook"] = true
webhooks, err := models.QueryWebhooks(models.QueryWebhookOptions{
Limit: 50,
Order: "created desc",
})
if err != nil {
ctx.Error(500, err.Error())
return
}
ctx.Data["Webhooks"] = webhooks
ctx.HTML(200, "webhook/list")
}
示例8: NewApplicationPost
func NewApplicationPost(ctx *context.Context, form NewApplicationForm) {
ctx.Data["Title"] = "New Application"
ctx.Data["PageIsApplication"] = true
if ctx.HasError() {
ctx.HTML(200, "application/new")
return
}
app, err := models.NewApplication(form.Name)
if err != nil {
if errors.IsApplicationExists(err) {
ctx.Data["Err_Name"] = true
ctx.RenderWithErr("Application name has been used.", "application/new", form)
} else {
ctx.Handle(500, "NewApplication", err)
}
return
}
ctx.Redirect(fmt.Sprintf("/applications/%d", app.ID))
}
示例9: NewCollectorPost
func NewCollectorPost(ctx *context.Context, form NewCollectorForm) {
ctx.Data["Title"] = "New Collector"
ctx.Data["PageIsCollector"] = true
if ctx.HasError() {
ctx.HTML(200, "collector/new")
return
}
collector, err := models.NewCollector(form.Name, models.COLLECT_TYPE_GITHUB)
if err != nil {
if errors.IsCollectorExists(err) {
ctx.Data["Err_Name"] = true
ctx.RenderWithErr("Collector name has been used.", "collector/new", form)
} else {
ctx.Handle(500, "NewCollector", err)
}
return
}
ctx.Redirect(fmt.Sprintf("/collectors/%d", collector.ID))
}
示例10: Config
func Config(ctx *context.Context) {
ctx.Data["Title"] = "Configuration"
ctx.Data["PageIsConfig"] = true
ctx.HTML(200, "config")
}
示例11: NewApplication
func NewApplication(ctx *context.Context) {
ctx.Data["Title"] = "New Application"
ctx.Data["PageIsApplication"] = true
ctx.HTML(200, "application/new")
}
示例12: NewCollector
func NewCollector(ctx *context.Context) {
ctx.Data["Title"] = "New Collector"
ctx.Data["PageIsCollector"] = true
ctx.HTML(200, "collector/new")
}