MCPcopy Index your code
hub / github.com/TruthHun/BookStack / GetPagerLinks

Function GetPagerLinks

utils/pager.go:77–96  ·  view source on GitHub ↗

** * 返回总记录条数,总页数,当前页面数据,分页html * 根据分页选项,生成分页连接 下面是一个实例: func (this *MainController) Test() { var po util.PageOptions po.EnablePreNexLink = true po.EnableFirstLastLink = true po.LinkItemCount = 7 po.TableName = "help_topic" cp, _ := this.GetInt("pno")

(po *PageOptions, requestURI string)

Source from the content-addressed store, hash-verified

75 }
76*/
77func GetPagerLinks(po *PageOptions, requestURI string) (int, int, orm.RawSeter, html.HTML) {
78 str := ""
79 totalItem, totalpages, rs := GetPagesInfo(po.TableName, po.CurrentPage, po.PageSize, po.Conditions)
80 po = setDefault(po, totalpages)
81 DealUri(po, requestURI)
82 if totalpages <= po.LinkItemCount {
83 str = fun1(po, totalpages) //显示完全 12345678910
84 } else if totalpages > po.LinkItemCount {
85 if po.CurrentPage < po.LinkItemCount {
86 str = fun2(po, totalpages) //123456789...200
87 } else {
88 if po.CurrentPage+po.LinkItemCount < totalpages {
89 str = fun3(po, totalpages)
90 } else {
91 str = fun4(po, totalpages)
92 }
93 }
94 }
95 return totalItem, totalpages, rs, html.HTML(str)
96}
97
98func GetPagerHtml(requestURI string, pageIndex, pageSize, totalCount int) html.HTML {
99 po := &PageOptions{

Callers

nothing calls this directly

Calls 7

GetPagesInfoFunction · 0.85
setDefaultFunction · 0.85
DealUriFunction · 0.85
fun1Function · 0.85
fun2Function · 0.85
fun3Function · 0.85
fun4Function · 0.85

Tested by

no test coverage detected