1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 18:58:38 +00:00

golint fixed for parts of routers root, dev, user and org dirs (#167)

* golint fixed for parts of routers root, dev and org dirs

* add user/auth.go golint fixed

* rename unnecessary exported to unexported and user dir golint fixed
This commit is contained in:
Lunny Xiao
2016-11-18 11:03:03 +08:00
committed by GitHub
parent 91953ae9b4
commit cf045b029c
11 changed files with 225 additions and 132 deletions

View File

@@ -14,19 +14,22 @@ import (
)
const (
CREATE base.TplName = "org/create"
// tplCreateOrg template path for create organization
tplCreateOrg base.TplName = "org/create"
)
// Create render the page for create organization
func Create(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("new_org")
ctx.HTML(200, CREATE)
ctx.HTML(200, tplCreateOrg)
}
// CreatePost response for create organization
func CreatePost(ctx *context.Context, form auth.CreateOrgForm) {
ctx.Data["Title"] = ctx.Tr("new_org")
if ctx.HasError() {
ctx.HTML(200, CREATE)
ctx.HTML(200, tplCreateOrg)
return
}
@@ -40,11 +43,11 @@ func CreatePost(ctx *context.Context, form auth.CreateOrgForm) {
ctx.Data["Err_OrgName"] = true
switch {
case models.IsErrUserAlreadyExist(err):
ctx.RenderWithErr(ctx.Tr("form.org_name_been_taken"), CREATE, &form)
ctx.RenderWithErr(ctx.Tr("form.org_name_been_taken"), tplCreateOrg, &form)
case models.IsErrNameReserved(err):
ctx.RenderWithErr(ctx.Tr("org.form.name_reserved", err.(models.ErrNameReserved).Name), CREATE, &form)
ctx.RenderWithErr(ctx.Tr("org.form.name_reserved", err.(models.ErrNameReserved).Name), tplCreateOrg, &form)
case models.IsErrNamePatternNotAllowed(err):
ctx.RenderWithErr(ctx.Tr("org.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), CREATE, &form)
ctx.RenderWithErr(ctx.Tr("org.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), tplCreateOrg, &form)
default:
ctx.Handle(500, "CreateOrganization", err)
}