parent
40dc458bb6
commit
fcbac38d6f
21 changed files with 165 additions and 196 deletions
|
@ -1,4 +1,5 @@
|
|||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
@ -14,8 +15,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/Unknwon/paginater"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -55,7 +54,6 @@ func Commits(ctx *context.Context) {
|
|||
if page <= 1 {
|
||||
page = 1
|
||||
}
|
||||
ctx.Data["Page"] = paginater.New(int(commitsCount), git.CommitsRangeSize, page, 5)
|
||||
|
||||
// Both `git log branchName` and `git log commitId` work.
|
||||
commits, err := ctx.Repo.Commit.CommitsByRange(page)
|
||||
|
@ -72,6 +70,11 @@ func Commits(ctx *context.Context) {
|
|||
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
|
||||
ctx.Data["CommitCount"] = commitsCount
|
||||
ctx.Data["Branch"] = ctx.Repo.BranchName
|
||||
|
||||
pager := context.NewPagination(int(commitsCount), git.CommitsRangeSize, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(200, tplCommits)
|
||||
}
|
||||
|
||||
|
@ -160,7 +163,6 @@ func FileHistory(ctx *context.Context) {
|
|||
if page <= 1 {
|
||||
page = 1
|
||||
}
|
||||
ctx.Data["Page"] = paginater.New(int(commitsCount), git.CommitsRangeSize, page, 5)
|
||||
|
||||
commits, err := ctx.Repo.GitRepo.CommitsByFileAndRange(branchName, fileName, page)
|
||||
if err != nil {
|
||||
|
@ -177,6 +179,11 @@ func FileHistory(ctx *context.Context) {
|
|||
ctx.Data["FileName"] = fileName
|
||||
ctx.Data["CommitCount"] = commitsCount
|
||||
ctx.Data["Branch"] = branchName
|
||||
|
||||
pager := context.NewPagination(int(commitsCount), git.CommitsRangeSize, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(200, tplCommits)
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/markup/markdown"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"github.com/Unknwon/paginater"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -51,7 +50,6 @@ func Milestones(ctx *context.Context) {
|
|||
} else {
|
||||
total = int(closedCount)
|
||||
}
|
||||
ctx.Data["Page"] = paginater.New(total, setting.UI.IssuePagingNum, page, 5)
|
||||
|
||||
miles, err := models.GetMilestones(ctx.Repo.Repository.ID, page, isShowClosed, sortType)
|
||||
if err != nil {
|
||||
|
@ -77,6 +75,11 @@ func Milestones(ctx *context.Context) {
|
|||
|
||||
ctx.Data["SortType"] = sortType
|
||||
ctx.Data["IsShowClosed"] = isShowClosed
|
||||
|
||||
pager := context.NewPagination(total, setting.UI.IssuePagingNum, page, 5)
|
||||
pager.AddParam(ctx, "state", "State")
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(200, tplMilestone)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/markup/markdown"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/Unknwon/paginater"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -120,9 +118,12 @@ func Releases(ctx *context.Context) {
|
|||
r.Note = markdown.RenderString(r.Note, ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())
|
||||
}
|
||||
|
||||
pager := paginater.New(int(count), limit, page, 5)
|
||||
ctx.Data["Page"] = pager
|
||||
ctx.Data["Releases"] = releases
|
||||
|
||||
pager := context.NewPagination(int(count), limit, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(200, tplReleases)
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/search"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/Unknwon/paginater"
|
||||
)
|
||||
|
||||
const tplSearch base.TplName = "repo/search"
|
||||
|
@ -36,12 +34,15 @@ func Search(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
ctx.Data["Keyword"] = keyword
|
||||
pager := paginater.New(total, setting.UI.RepoSearchPagingNum, page, 5)
|
||||
ctx.Data["Page"] = pager
|
||||
ctx.Data["SourcePath"] = setting.AppSubURL + "/" +
|
||||
path.Join(ctx.Repo.Repository.Owner.Name, ctx.Repo.Repository.Name, "src", "branch", ctx.Repo.Repository.DefaultBranch)
|
||||
ctx.Data["SearchResults"] = searchResults
|
||||
ctx.Data["RequireHighlightJS"] = true
|
||||
ctx.Data["PageIsViewCode"] = true
|
||||
|
||||
pager := context.NewPagination(total, setting.UI.RepoSearchPagingNum, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(200, tplSearch)
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/markup"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/templates"
|
||||
|
||||
"github.com/Unknwon/paginater"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -462,10 +460,10 @@ func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*
|
|||
if page <= 0 {
|
||||
page = 1
|
||||
}
|
||||
pager := paginater.New(total, models.ItemsPerPage, page, 5)
|
||||
pager := context.NewPagination(total, models.ItemsPerPage, page, 5)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
items, err := getter(pager.Current())
|
||||
items, err := getter(pager.Paginater.Current())
|
||||
if err != nil {
|
||||
ctx.ServerError("getter", err)
|
||||
return
|
||||
|
@ -480,6 +478,7 @@ func Watchers(ctx *context.Context) {
|
|||
ctx.Data["Title"] = ctx.Tr("repo.watchers")
|
||||
ctx.Data["CardsTitle"] = ctx.Tr("repo.watchers")
|
||||
ctx.Data["PageIsWatchers"] = true
|
||||
|
||||
RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, tplWatchers)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue