user/setting: preserve user input with validation error (#1123)

This commit is contained in:
Unknwon
2017-03-30 01:03:44 -04:00
parent ab634ce61a
commit 1afafde3b3
3 changed files with 23 additions and 11 deletions

View File

@@ -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 {