summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-13 19:46:48 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-13 19:46:48 -0400
commit5ed5aa5228feba935679df8cb676af62018cc25d (patch)
tree91eab6292ed10c2e0bfe606ae972d9a03c1cb3e3 /routers
parent33ec0632ffd9e770793eba57393f27385d5f392d (diff)
downloadgitea-5ed5aa5228feba935679df8cb676af62018cc25d.tar.gz
gitea-5ed5aa5228feba935679df8cb676af62018cc25d.zip
Finish milestone
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/issue.go34
1 files changed, 31 insertions, 3 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 38a971a0f2..8a894aa8c0 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -567,6 +567,34 @@ func UpdateMilestone(ctx *middleware.Context, params martini.Params) {
}
return
}
+
+ action := params["action"]
+ if len(action) > 0 {
+ switch action {
+ case "open":
+ if mile.IsClosed {
+ if err = models.ChangeMilestoneStatus(mile, false); err != nil {
+ ctx.Handle(500, "issue.UpdateMilestone(ChangeMilestoneStatus)", err)
+ return
+ }
+ }
+ case "close":
+ if !mile.IsClosed {
+ if err = models.ChangeMilestoneStatus(mile, true); err != nil {
+ ctx.Handle(500, "issue.UpdateMilestone(ChangeMilestoneStatus)", err)
+ return
+ }
+ }
+ case "delete":
+ if err = models.DeleteMilestone(mile); err != nil {
+ ctx.Handle(500, "issue.UpdateMilestone(DeleteMilestone)", err)
+ return
+ }
+ }
+ ctx.Redirect(ctx.Repo.RepoLink + "/issues/milestones")
+ return
+ }
+
mile.DeadlineString = mile.Deadline.UTC().Format("01/02/2006")
if mile.DeadlineString == "12/31/9999" {
mile.DeadlineString = ""
@@ -583,16 +611,16 @@ func UpdateMilestonePost(ctx *middleware.Context, params martini.Params, form au
idx, _ := base.StrTo(params["index"]).Int64()
if idx == 0 {
- ctx.Handle(404, "issue.UpdateMilestone", nil)
+ ctx.Handle(404, "issue.UpdateMilestonePost", nil)
return
}
mile, err := models.GetMilestoneByIndex(ctx.Repo.Repository.Id, idx)
if err != nil {
if err == models.ErrMilestoneNotExist {
- ctx.Handle(404, "issue.UpdateMilestone(GetMilestoneByIndex)", err)
+ ctx.Handle(404, "issue.UpdateMilestonePost(GetMilestoneByIndex)", err)
} else {
- ctx.Handle(500, "issue.UpdateMilestone(GetMilestoneByIndex)", err)
+ ctx.Handle(500, "issue.UpdateMilestonePost(GetMilestoneByIndex)", err)
}
return
}