1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Unifies pagination template usage (#6531) (#6533)

This commit is contained in:
Mario Lubenka
2019-04-20 06:15:19 +02:00
committed by techknowlogick
parent 40dc458bb6
commit fcbac38d6f
21 changed files with 165 additions and 196 deletions

View File

@@ -27,7 +27,6 @@ import (
"code.gitea.io/gitea/modules/util"
"github.com/Unknwon/com"
"github.com/Unknwon/paginater"
)
const (
@@ -186,8 +185,7 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
} else {
total = int(issueStats.ClosedCount)
}
pager := paginater.New(total, setting.UI.IssuePagingNum, page, 5)
ctx.Data["Page"] = pager
pager := context.NewPagination(total, setting.UI.IssuePagingNum, page, 5)
var issues []*models.Issue
if forceEmpty {
@@ -199,7 +197,7 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
PosterID: posterID,
MentionedID: mentionedID,
MilestoneID: milestoneID,
Page: pager.Current(),
Page: pager.Paginater.Current(),
PageSize: setting.UI.IssuePagingNum,
IsClosed: util.OptionalBoolOf(isShowClosed),
IsPull: isPullOption,
@@ -268,6 +266,15 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
} else {
ctx.Data["State"] = "open"
}
pager.AddParam(ctx, "q", "Keyword")
pager.AddParam(ctx, "type", "ViewType")
pager.AddParam(ctx, "sort", "SortType")
pager.AddParam(ctx, "state", "State")
pager.AddParam(ctx, "labels", "SelectLabels")
pager.AddParam(ctx, "milestone", "MilestoneID")
pager.AddParam(ctx, "assignee", "AssigneeID")
ctx.Data["Page"] = pager
}
// Issues render issues page