mirror of
https://github.com/go-gitea/gitea
synced 2024-12-24 03:35:55 +01:00
Mirror fix on admin/orgs paging
This commit is contained in:
parent
79262173a6
commit
d78abd3561
2
gogs.go
2
gogs.go
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.5.5.1009 Beta"
|
const APP_VER = "0.5.5.1010 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
@ -25,7 +25,7 @@ func Organizations(ctx *middleware.Context) {
|
|||||||
var err error
|
var err error
|
||||||
ctx.Data["Orgs"], err = models.GetOrganizations(pageNum, (p-1)*pageNum)
|
ctx.Data["Orgs"], err = models.GetOrganizations(pageNum, (p-1)*pageNum)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "GetUsers", err)
|
ctx.Handle(500, "GetOrganizations", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.HTML(200, ORGS)
|
ctx.HTML(200, ORGS)
|
||||||
|
@ -24,14 +24,14 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func pagination(ctx *middleware.Context, count int64, pageNum int) int {
|
func pagination(ctx *middleware.Context, count int64, pageNum int) int {
|
||||||
p := com.StrTo(ctx.Query("p")).MustInt()
|
p := ctx.QueryInt("p")
|
||||||
if p < 1 {
|
if p < 1 {
|
||||||
p = 1
|
p = 1
|
||||||
}
|
}
|
||||||
curCount := int64((p-1)*pageNum + pageNum)
|
curCount := int64((p-1)*pageNum + pageNum)
|
||||||
if curCount > count {
|
if curCount >= count {
|
||||||
p = int(count) / pageNum
|
p = int(count) / pageNum
|
||||||
} else if count > curCount {
|
} else {
|
||||||
ctx.Data["NextPageNum"] = p + 1
|
ctx.Data["NextPageNum"] = p + 1
|
||||||
}
|
}
|
||||||
if p > 1 {
|
if p > 1 {
|
||||||
|
@ -1 +1 @@
|
|||||||
0.5.5.1009 Beta
|
0.5.5.1010 Beta
|
Loading…
Reference in New Issue
Block a user