diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-12-06 01:47:04 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-12-06 01:47:04 -0800 |
commit | a53aec78899dad3d9ccdac86677d0b3918a4c876 (patch) | |
tree | 2df7c2164198ac8ac6fe6d752e64f5d7508349a2 /system/admin/handlers.go | |
parent | 9364de53baf8ad1fb4a30e9582aa90cd599221a2 (diff) |
adding disabled zero-content pagination and minor fixes
Diffstat (limited to 'system/admin/handlers.go')
-rw-r--r-- | system/admin/handlers.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/system/admin/handlers.go b/system/admin/handlers.go index 6293974..6b5de26 100644 --- a/system/admin/handlers.go +++ b/system/admin/handlers.go @@ -976,6 +976,10 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { start := 1 + count*offset end := start + count - 1 + if total < end { + end = total + } + pagination := fmt.Sprintf(` <ul class="pagination row"> <li class="col s2 waves-effect %s"><a href="%s"><i class="material-icons">chevron_left</i></a></li> @@ -984,6 +988,18 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { </ul> `, prevStatus, prevURL, start, end, total, nextStatus, nextURL) + // show indicator that a collection of items will be listed implicitly, but + // that none are created yet + if total < 1 { + pagination = ` + <ul class="pagination row"> + <li class="col s2 waves-effect disabled"><a href="#"><i class="material-icons">chevron_left</i></a></li> + <li class="col s8">0 to 0 of 0</li> + <li class="col s2 waves-effect disabled"><a href="#"><i class="material-icons">chevron_right</i></a></li> + </ul> + ` + } + b.Write([]byte(pagination + `</div></div>`)) script := ` |