aboutsummaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-18 18:07:04 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-18 18:07:04 -0400
commit93f8f9252304d4e8028e13dd95e4cdf2e3178594 (patch)
tree43218b1bbb2f3cb466b9afa8ed60022924526519 /routers
parenta4c3ab48a52a0cade5d3c3ba76c5555ed1453566 (diff)
Finish create new label
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/issue.go33
1 files changed, 32 insertions, 1 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 83b84e28..6ff72c19 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -63,7 +63,16 @@ func Issues(ctx *middleware.Context) {
}
mid = mile.Id
}
- fmt.Println(mid)
+
+ labels, err := models.GetLabels(ctx.Repo.Repository.Id)
+ if err != nil {
+ ctx.Handle(500, "issue.Issues(GetLabels): %v", err)
+ return
+ }
+ for _, l := range labels {
+ l.CalOpenIssues()
+ }
+ ctx.Data["Labels"] = labels
page, _ := base.StrTo(ctx.Query("page")).Int()
@@ -591,6 +600,28 @@ func Comment(ctx *middleware.Context, params martini.Params) {
ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, index))
}
+func NewLabel(ctx *middleware.Context, form auth.CreateLabelForm) {
+ if ctx.HasError() {
+ Issues(ctx)
+ return
+ }
+
+ l := &models.Label{
+ RepoId: ctx.Repo.Repository.Id,
+ Name: form.Title,
+ Color: form.Color,
+ }
+ if err := models.NewLabel(l); err != nil {
+ ctx.Handle(500, "issue.NewLabel(NewLabel)", err)
+ return
+ }
+ ctx.Redirect(ctx.Repo.RepoLink + "/issues")
+}
+
+func UpdateLabel(ctx *middleware.Context, params martini.Params) {
+
+}
+
func Milestones(ctx *middleware.Context) {
ctx.Data["Title"] = "Milestones"
ctx.Data["IsRepoToolbarIssues"] = true