func RetrieveRepoMilestonesAndAssignees(ctx *context.Context, repo *models.Repository) { var err error ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.ID, -1, false) if err != nil { ctx.Handle(500, "GetMilestones: %v", err) return } ctx.Data["ClosedMilestones"], err = models.GetMilestones(repo.ID, -1, true) if err != nil { ctx.Handle(500, "GetMilestones: %v", err) return } ctx.Data["Assignees"], err = repo.GetAssignees() if err != nil { ctx.Handle(500, "GetAssignees: %v", err) return } }
func Milestones(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.milestones") ctx.Data["PageIsIssueList"] = true ctx.Data["PageIsMilestones"] = true isShowClosed := ctx.Query("state") == "closed" openCount, closedCount := models.MilestoneStats(ctx.Repo.Repository.ID) ctx.Data["OpenCount"] = openCount ctx.Data["ClosedCount"] = closedCount page := ctx.QueryInt("page") if page <= 1 { page = 1 } var total int if !isShowClosed { total = int(openCount) } else { total = int(closedCount) } ctx.Data["Page"] = paginater.New(total, setting.IssuePagingNum, page, 5) miles, err := models.GetMilestones(ctx.Repo.Repository.ID, page, isShowClosed) if err != nil { ctx.Handle(500, "GetMilestones", err) return } for _, m := range miles { m.RenderedContent = string(markdown.Render([]byte(m.Content), ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())) } ctx.Data["Milestones"] = miles if isShowClosed { ctx.Data["State"] = "closed" } else { ctx.Data["State"] = "open" } ctx.Data["IsShowClosed"] = isShowClosed ctx.HTML(200, MILESTONE) }