diff options
author | Unknwon <u@gogs.io> | 2017-03-30 01:03:44 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-03-30 01:03:44 -0400 |
commit | 1afafde3b30b3d063bcff11ba6f1412e3f692d0a (patch) | |
tree | 90b7fc915e0d1e9c941df5a9435cb64470268abe /modules/context/context.go | |
parent | ab634ce61af234e220e8cb54204d652e2ec507df (diff) |
user/setting: preserve user input with validation error (#1123)
Diffstat (limited to 'modules/context/context.go')
-rw-r--r-- | modules/context/context.go | 7 |
1 files changed, 6 insertions, 1 deletions
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 { |