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

Function setDefault

utils/pager.go:297–326  ·  view source on GitHub ↗

** * 设置默认值 */

(po *PageOptions, totalpages int)

Source from the content-addressed store, hash-verified

295 * 设置默认值
296 */
297func setDefault(po *PageOptions, totalpages int) *PageOptions {
298 if len(po.FirstPageText) <= 0 {
299 po.FirstPageText = "&laquo;"
300 }
301 if len(po.LastPageText) <= 0 {
302 po.LastPageText = "&raquo;"
303 }
304 if len(po.PrePageText) <= 0 {
305 po.PrePageText = "&lsaquo;"
306 }
307 if len(po.NextPageText) <= 0 {
308 po.NextPageText = "&rsaquo;"
309 }
310 if po.CurrentPage >= totalpages {
311 po.CurrentPage = totalpages
312 }
313 if po.CurrentPage <= 1 {
314 po.CurrentPage = 1
315 }
316 if po.LinkItemCount == 0 {
317 po.LinkItemCount = 10
318 }
319 if po.PageSize == 0 {
320 po.PageSize = 20
321 }
322 if len(po.ParamName) <= 0 {
323 po.ParamName = "pno"
324 }
325 return po
326}
327
328/**
329 *判断首页尾页 上一页下一页是否能用

Callers 2

GetPagerLinksFunction · 0.85
GetPagerHtmlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected