Support edit release and save as draft
This commit is contained in:
parent
fb0972afad
commit
e07674bff1
13 changed files with 300 additions and 85 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -21,21 +21,17 @@ import (
|
|||
|
||||
func RepoAssignment(redirect bool, args ...bool) martini.Handler {
|
||||
return func(ctx *Context, params martini.Params) {
|
||||
log.Trace(fmt.Sprint(args))
|
||||
// valid brachname
|
||||
var validBranch bool
|
||||
// display bare quick start if it is a bare repo
|
||||
var displayBare bool
|
||||
|
||||
if len(args) >= 1 {
|
||||
// Note: argument has wrong value in Go1.3 martini.
|
||||
// validBranch = args[0]
|
||||
validBranch = true
|
||||
validBranch = args[0]
|
||||
}
|
||||
|
||||
if len(args) >= 2 {
|
||||
// displayBare = args[1]
|
||||
displayBare = true
|
||||
displayBare = args[1]
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue