mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 14:37:51 +01:00
changed integrated page number to GET
This commit is contained in:
parent
87d64acc9f
commit
5c39d3fa7d
@ -514,8 +514,8 @@ func runWeb(ctx *cli.Context) {
|
|||||||
m.Get("/labels/", repo.RetrieveLabels, repo.Labels)
|
m.Get("/labels/", repo.RetrieveLabels, repo.Labels)
|
||||||
m.Get("/milestones", repo.Milestones)
|
m.Get("/milestones", repo.Milestones)
|
||||||
m.Get("/branches", repo.Branches)
|
m.Get("/branches", repo.Branches)
|
||||||
m.Get("/stars/?:index", middleware.RepoRef(), repo.Stars)
|
m.Get("/stars", middleware.RepoRef(), repo.Stars)
|
||||||
m.Get("/watchers/?:index", middleware.RepoRef(), repo.Watchers)
|
m.Get("/watchers", middleware.RepoRef(), repo.Watchers)
|
||||||
m.Get("/forks", middleware.RepoRef(), repo.Forks)
|
m.Get("/forks", middleware.RepoRef(), repo.Forks)
|
||||||
m.Get("/archive/*", repo.Download)
|
m.Get("/archive/*", repo.Download)
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ var (
|
|||||||
Gitignores, Licenses, Readmes []string
|
Gitignores, Licenses, Readmes []string
|
||||||
|
|
||||||
// Maximum items per page in forks, watchers and stars of a repo
|
// Maximum items per page in forks, watchers and stars of a repo
|
||||||
ItemsPerPage = 3
|
ItemsPerPage = 54
|
||||||
)
|
)
|
||||||
|
|
||||||
func LoadRepoConfig() {
|
func LoadRepoConfig() {
|
||||||
|
@ -19,21 +19,21 @@ const (
|
|||||||
func Stars(ctx *middleware.Context) {
|
func Stars(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("repos.stars")
|
ctx.Data["Title"] = ctx.Tr("repos.stars")
|
||||||
|
|
||||||
page := ctx.ParamsInt(":index")
|
page := ctx.QueryInt("page")
|
||||||
if page <= 0 {
|
if page <= 0 {
|
||||||
page = 1
|
page = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["Page"] = paginater.New(ctx.Repo.Repository.NumStars, models.ItemsPerPage, page, 5)
|
ctx.Data["Page"] = paginater.New(ctx.Repo.Repository.NumStars, models.ItemsPerPage, page, 5)
|
||||||
|
|
||||||
stars, err := ctx.Repo.Repository.GetStars(ctx.ParamsInt(":index"))
|
stars, err := ctx.Repo.Repository.GetStars(ctx.QueryInt("page"))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetStars", err)
|
ctx.Handle(500, "GetStars", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.ParamsInt(":index")-1)*models.ItemsPerPage > ctx.Repo.Repository.NumStars {
|
if (ctx.QueryInt("page")-1)*models.ItemsPerPage > ctx.Repo.Repository.NumStars {
|
||||||
ctx.Handle(404, "ctx.Repo.Repository.NumStars", nil)
|
ctx.Handle(404, "ctx.Repo.Repository.NumStars", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -19,21 +19,21 @@ const (
|
|||||||
func Watchers(ctx *middleware.Context) {
|
func Watchers(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("repos.watches")
|
ctx.Data["Title"] = ctx.Tr("repos.watches")
|
||||||
|
|
||||||
page := ctx.ParamsInt(":index")
|
page := ctx.QueryInt("page")
|
||||||
if page <= 0 {
|
if page <= 0 {
|
||||||
page = 1
|
page = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["Page"] = paginater.New(ctx.Repo.Repository.NumWatches, models.ItemsPerPage, page, 5)
|
ctx.Data["Page"] = paginater.New(ctx.Repo.Repository.NumWatches, models.ItemsPerPage, page, 5)
|
||||||
|
|
||||||
watchers, err := ctx.Repo.Repository.GetWatchers(ctx.ParamsInt(":index"))
|
watchers, err := ctx.Repo.Repository.GetWatchers(ctx.QueryInt("page"))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetWatchers", err)
|
ctx.Handle(500, "GetWatchers", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.ParamsInt(":index")-1)*models.ItemsPerPage > ctx.Repo.Repository.NumWatches {
|
if (ctx.QueryInt("page")-1)*models.ItemsPerPage > ctx.Repo.Repository.NumWatches {
|
||||||
ctx.Handle(404, "ctx.Repo.Repository.NumWatches", nil)
|
ctx.Handle(404, "ctx.Repo.Repository.NumWatches", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -35,19 +35,19 @@
|
|||||||
{{if gt .TotalPages 1}}
|
{{if gt .TotalPages 1}}
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
{{if .HasPrevious}}
|
{{if .HasPrevious}}
|
||||||
<a href="{{$.RepoLink}}/stars/{{.Previous}}">{{$.i18n.Tr "issues.previous"}}</a>
|
<a href="{{$.RepoLink}}/stars?page={{.Previous}}">{{$.i18n.Tr "issues.previous"}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{range .Pages}}
|
{{range .Pages}}
|
||||||
{{if eq .Num -1}}
|
{{if eq .Num -1}}
|
||||||
<a class="disabled item">...</a>
|
<a class="disabled item">...</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.RepoLink}}/stars/{{.Num}}"{{end}}>{{.Num}}</a>
|
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.RepoLink}}/stars?page={{.Num}}"{{end}}>{{.Num}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if .HasNext}}
|
{{if .HasNext}}
|
||||||
<a href="{{$.RepoLink}}/stars/{{.Next}}">{{$.i18n.Tr "issues.next"}}</a>
|
<a href="{{$.RepoLink}}/stars?page={{.Next}}">{{$.i18n.Tr "issues.next"}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -35,19 +35,19 @@
|
|||||||
{{if gt .TotalPages 1}}
|
{{if gt .TotalPages 1}}
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
{{if .HasPrevious}}
|
{{if .HasPrevious}}
|
||||||
<a href="{{$.RepoLink}}/watchers/{{.Previous}}">{{$.i18n.Tr "issues.previous"}}</a>
|
<a href="{{$.RepoLink}}/watchers?page={{.Previous}}">{{$.i18n.Tr "issues.previous"}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{range .Pages}}
|
{{range .Pages}}
|
||||||
{{if eq .Num -1}}
|
{{if eq .Num -1}}
|
||||||
<a class="disabled item">...</a>
|
<a class="disabled item">...</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.RepoLink}}/watchers/{{.Num}}"{{end}}>{{.Num}}</a>
|
<a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.RepoLink}}/watchers?page={{.Num}}"{{end}}>{{.Num}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if .HasNext}}
|
{{if .HasNext}}
|
||||||
<a href="{{$.RepoLink}}/watchers/{{.Next}}">{{$.i18n.Tr "issues.next"}}</a>
|
<a href="{{$.RepoLink}}/watchers?page={{.Next}}">{{$.i18n.Tr "issues.next"}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
Loading…
Reference in New Issue
Block a user