From 1afafde3b30b3d063bcff11ba6f1412e3f692d0a Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 30 Mar 2017 01:03:44 -0400 Subject: user/setting: preserve user input with validation error (#1123) --- modules/context/context.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/context/context.go b/modules/context/context.go index f543e766..04f4ba3e 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -79,12 +79,17 @@ func (ctx *Context) HasValue(name string) bool { return ok } -// HTML calls Context.HTML and converts template name to string. +// HTML responses template with given status. func (ctx *Context) HTML(status int, name base.TplName) { log.Trace("Template: %s", name) ctx.Context.HTML(status, string(name)) } +// Success responses template with status 200. +func (c *Context) Success(name base.TplName) { + c.HTML(200, name) +} + // RenderWithErr used for page has form validation but need to prompt error to users. func (ctx *Context) RenderWithErr(msg string, tpl base.TplName, f interface{}) { if f != nil { -- cgit v1.2.3