org.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package form
  5. import (
  6. "github.com/go-macaron/binding"
  7. "gopkg.in/macaron.v1"
  8. )
  9. type CreateOrg struct {
  10. OrgName string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
  11. }
  12. func (f *CreateOrg) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  13. return validate(errs, ctx.Data, f, ctx.Locale)
  14. }
  15. type UpdateOrgSetting struct {
  16. Name string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
  17. FullName string `binding:"MaxSize(100)"`
  18. Description string `binding:"MaxSize(255)"`
  19. Website string `binding:"Url;MaxSize(100)"`
  20. Location string `binding:"MaxSize(50)"`
  21. MaxRepoCreation int
  22. }
  23. func (f *UpdateOrgSetting) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  24. return validate(errs, ctx.Data, f, ctx.Locale)
  25. }
  26. type CreateTeam struct {
  27. TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"`
  28. Description string `binding:"MaxSize(255)"`
  29. Permission string
  30. }
  31. func (f *CreateTeam) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  32. return validate(errs, ctx.Data, f, ctx.Locale)
  33. }