diff options
author | Bwko <bouwko@gmail.com> | 2016-12-24 15:41:09 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2016-12-24 22:41:09 +0800 |
commit | a345a03d99f6e3d46a20620869e29424a0c55499 (patch) | |
tree | 5f1b218a6b5d1a782101914bf2d8504f95c76918 /routers/repo/issue.go | |
parent | f27d87d93ba8578dfc36b636de5dc01e26e58d0d (diff) | |
download | gitea-a345a03d99f6e3d46a20620869e29424a0c55499.tar.gz gitea-a345a03d99f6e3d46a20620869e29424a0c55499.zip |
Added sorting to the labels & milestones page (#199)
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r-- | routers/repo/issue.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 14c1ea1aa7..1cf5722ed1 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -82,7 +82,7 @@ func MustAllowPulls(ctx *context.Context) { // RetrieveLabels find all the labels of a repository func RetrieveLabels(ctx *context.Context) { - labels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID) + labels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID, ctx.Query("sort")) if err != nil { ctx.Handle(500, "RetrieveLabels.GetLabels", err) return @@ -92,6 +92,7 @@ func RetrieveLabels(ctx *context.Context) { } ctx.Data["Labels"] = labels ctx.Data["NumLabels"] = len(labels) + ctx.Data["SortType"] = ctx.Query("sort") } // Issues render issues page @@ -274,12 +275,12 @@ func renderAttachmentSettings(ctx *context.Context) { // RetrieveRepoMilestonesAndAssignees find all the milestones and assignees of a repository func RetrieveRepoMilestonesAndAssignees(ctx *context.Context, repo *models.Repository) { var err error - ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.ID, -1, false) + ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.ID, -1, false, "") if err != nil { ctx.Handle(500, "GetMilestones", err) return } - ctx.Data["ClosedMilestones"], err = models.GetMilestones(repo.ID, -1, true) + ctx.Data["ClosedMilestones"], err = models.GetMilestones(repo.ID, -1, true, "") if err != nil { ctx.Handle(500, "GetMilestones", err) return @@ -298,7 +299,7 @@ func RetrieveRepoMetas(ctx *context.Context, repo *models.Repository) []*models. return nil } - labels, err := models.GetLabelsByRepoID(repo.ID) + labels, err := models.GetLabelsByRepoID(repo.ID, "") if err != nil { ctx.Handle(500, "GetLabelsByRepoID", err) return nil @@ -583,7 +584,7 @@ func ViewIssue(ctx *context.Context) { for i := range issue.Labels { labelIDMark[issue.Labels[i].ID] = true } - labels, err := models.GetLabelsByRepoID(repo.ID) + labels, err := models.GetLabelsByRepoID(repo.ID, "") if err != nil { ctx.Handle(500, "GetLabelsByRepoID", err) return @@ -1079,6 +1080,7 @@ func Milestones(ctx *context.Context) { ctx.Data["OpenCount"] = openCount ctx.Data["ClosedCount"] = closedCount + sortType := ctx.Query("sort") page := ctx.QueryInt("page") if page <= 1 { page = 1 @@ -1092,7 +1094,7 @@ func Milestones(ctx *context.Context) { } ctx.Data["Page"] = paginater.New(total, setting.UI.IssuePagingNum, page, 5) - miles, err := models.GetMilestones(ctx.Repo.Repository.ID, page, isShowClosed) + miles, err := models.GetMilestones(ctx.Repo.Repository.ID, page, isShowClosed, sortType) if err != nil { ctx.Handle(500, "GetMilestones", err) return @@ -1108,6 +1110,7 @@ func Milestones(ctx *context.Context) { ctx.Data["State"] = "open" } + ctx.Data["SortType"] = sortType ctx.Data["IsShowClosed"] = isShowClosed ctx.HTML(200, tplMilestone) } |