You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
953 B

10 years ago
10 years ago
  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 auth
  5. import (
  6. "net/http"
  7. "reflect"
  8. "github.com/go-martini/martini"
  9. "github.com/gogits/gogs/modules/base"
  10. "github.com/gogits/gogs/modules/middleware/binding"
  11. )
  12. type CreateIssueForm struct {
  13. IssueName string `form:"title" binding:"Required;MaxSize(50)"`
  14. MilestoneId int64 `form:"milestoneid"`
  15. AssigneeId int64 `form:"assigneeid"`
  16. Labels string `form:"labels"`
  17. Content string `form:"content"`
  18. }
  19. func (f *CreateIssueForm) Name(field string) string {
  20. names := map[string]string{
  21. "IssueName": "Issue name",
  22. }
  23. return names[field]
  24. }
  25. func (f *CreateIssueForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) {
  26. data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
  27. validate(errors, data, f)
  28. }