diff options
author | Unknown <joe2010xtmf@163.com> | 2014-06-12 17:47:23 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-06-12 17:47:23 -0400 |
commit | e07674bff19dcc321a1611a3598d69c418ac8642 (patch) | |
tree | 824174b3dea4490f00c713778688bff59d35d98f /modules/auth/repo.go | |
parent | fb0972afadbd87ae707861acc0986bde01528c3c (diff) | |
download | gitea-e07674bff19dcc321a1611a3598d69c418ac8642.tar.gz gitea-e07674bff19dcc321a1611a3598d69c418ac8642.zip |
Support edit release and save as draft
Diffstat (limited to 'modules/auth/repo.go')
-rw-r--r-- | modules/auth/repo.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/modules/auth/repo.go b/modules/auth/repo.go index 26ab7551ca..92ba64a27b 100644 --- a/modules/auth/repo.go +++ b/modules/auth/repo.go @@ -208,6 +208,7 @@ type NewReleaseForm struct { Target string `form:"tag_target" binding:"Required"` Title string `form:"title" binding:"Required"` Content string `form:"content" binding:"Required"` + Draft string `form:"draft"` Prerelease bool `form:"prerelease"` } @@ -225,3 +226,25 @@ func (f *NewReleaseForm) Validate(errors *binding.Errors, req *http.Request, con data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData) validate(errors, data, f) } + +type EditReleaseForm struct { + Target string `form:"tag_target" binding:"Required"` + Title string `form:"title" binding:"Required"` + Content string `form:"content" binding:"Required"` + Draft string `form:"draft"` + Prerelease bool `form:"prerelease"` +} + +func (f *EditReleaseForm) Name(field string) string { + names := map[string]string{ + "Target": "Target", + "Title": "Release title", + "Content": "Release content", + } + return names[field] +} + +func (f *EditReleaseForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) { + data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData) + validate(errors, data, f) +} |