diff options
author | kendaru <soud@protonmail.com> | 2015-10-02 10:04:11 +0200 |
---|---|---|
committer | kendaru <soud@protonmail.com> | 2015-10-02 10:04:11 +0200 |
commit | 5c39d3fa7dfcb81bdaed222a73c8a7d3dd807e36 (patch) | |
tree | a1998d60ea8b59aad6ac6710d2103bddb3675ed8 | |
parent | 87d64acc9f7de985603093980c8dc3fa651047a1 (diff) | |
download | gitea-5c39d3fa7dfcb81bdaed222a73c8a7d3dd807e36.tar.gz gitea-5c39d3fa7dfcb81bdaed222a73c8a7d3dd807e36.zip |
changed integrated page number to GET
-rw-r--r-- | cmd/web.go | 4 | ||||
-rw-r--r-- | models/repo.go | 2 | ||||
-rw-r--r-- | routers/repo/stars.go | 6 | ||||
-rw-r--r-- | routers/repo/watchers.go | 6 | ||||
-rw-r--r-- | templates/repo/stars.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/watchers.tmpl | 6 |
6 files changed, 15 insertions, 15 deletions
diff --git a/cmd/web.go b/cmd/web.go index 126a86a35f..9881a76cc5 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -514,8 +514,8 @@ func runWeb(ctx *cli.Context) { m.Get("/labels/", repo.RetrieveLabels, repo.Labels) m.Get("/milestones", repo.Milestones) m.Get("/branches", repo.Branches) - m.Get("/stars/?:index", middleware.RepoRef(), repo.Stars) - m.Get("/watchers/?:index", middleware.RepoRef(), repo.Watchers) + m.Get("/stars", middleware.RepoRef(), repo.Stars) + m.Get("/watchers", middleware.RepoRef(), repo.Watchers) m.Get("/forks", middleware.RepoRef(), repo.Forks) m.Get("/archive/*", repo.Download) diff --git a/models/repo.go b/models/repo.go index fc155fa5f5..d70454fc1c 100644 --- a/models/repo.go +++ b/models/repo.go @@ -48,7 +48,7 @@ var ( Gitignores, Licenses, Readmes []string // Maximum items per page in forks, watchers and stars of a repo - ItemsPerPage = 3 + ItemsPerPage = 54 ) func LoadRepoConfig() { diff --git a/routers/repo/stars.go b/routers/repo/stars.go index ffccd1765b..93854886c0 100644 --- a/routers/repo/stars.go +++ b/routers/repo/stars.go @@ -19,21 +19,21 @@ const ( func Stars(ctx *middleware.Context) { ctx.Data["Title"] = ctx.Tr("repos.stars") - page := ctx.ParamsInt(":index") + page := ctx.QueryInt("page") if page <= 0 { page = 1 } 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 { ctx.Handle(500, "GetStars", err) 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) return } diff --git a/routers/repo/watchers.go b/routers/repo/watchers.go index 8765b18376..8626fa2371 100644 --- a/routers/repo/watchers.go +++ b/routers/repo/watchers.go @@ -19,21 +19,21 @@ const ( func Watchers(ctx *middleware.Context) { ctx.Data["Title"] = ctx.Tr("repos.watches") - page := ctx.ParamsInt(":index") + page := ctx.QueryInt("page") if page <= 0 { page = 1 } 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 { ctx.Handle(500, "GetWatchers", err) 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) return } diff --git a/templates/repo/stars.tmpl b/templates/repo/stars.tmpl index 8ac67f5c50..af3193dcf7 100644 --- a/templates/repo/stars.tmpl +++ b/templates/repo/stars.tmpl @@ -35,19 +35,19 @@ {{if gt .TotalPages 1}} <div class="pagination"> {{if .HasPrevious}} - <a href="{{$.RepoLink}}/stars/{{.Previous}}">{{$.i18n.Tr "issues.previous"}}</a> + <a href="{{$.RepoLink}}/stars?page={{.Previous}}">{{$.i18n.Tr "issues.previous"}}</a> {{end}} {{range .Pages}} {{if eq .Num -1}} <a class="disabled item">...</a> {{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}} {{if .HasNext}} - <a href="{{$.RepoLink}}/stars/{{.Next}}">{{$.i18n.Tr "issues.next"}}</a> + <a href="{{$.RepoLink}}/stars?page={{.Next}}">{{$.i18n.Tr "issues.next"}}</a> {{end}} </div> {{end}} diff --git a/templates/repo/watchers.tmpl b/templates/repo/watchers.tmpl index f02b201304..03aba0e9ad 100644 --- a/templates/repo/watchers.tmpl +++ b/templates/repo/watchers.tmpl @@ -35,19 +35,19 @@ {{if gt .TotalPages 1}} <div class="pagination"> {{if .HasPrevious}} - <a href="{{$.RepoLink}}/watchers/{{.Previous}}">{{$.i18n.Tr "issues.previous"}}</a> + <a href="{{$.RepoLink}}/watchers?page={{.Previous}}">{{$.i18n.Tr "issues.previous"}}</a> {{end}} {{range .Pages}} {{if eq .Num -1}} <a class="disabled item">...</a> {{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}} {{if .HasNext}} - <a href="{{$.RepoLink}}/watchers/{{.Next}}">{{$.i18n.Tr "issues.next"}}</a> + <a href="{{$.RepoLink}}/watchers?page={{.Next}}">{{$.i18n.Tr "issues.next"}}</a> {{end}} </div> {{end}} |