Only show pagination if it is needed
This commit is contained in:
parent
c663ef6d2a
commit
b5cbd71b68
1 changed files with 23 additions and 19 deletions
|
@ -27,6 +27,8 @@
|
|||
(for [p (range from (inc to))] (page p (= p current) "active" p)))
|
||||
|
||||
(defn pagination [num current]
|
||||
(if (< num 2)
|
||||
""
|
||||
(h/html
|
||||
[:nav.pull-right.clearfix {:aria-label "Page navigation"}
|
||||
[:ul.pagination.hidden-sm-down
|
||||
|
@ -37,9 +39,11 @@
|
|||
(>= current (- num 6)) (h/html (pagelist 1 2 current) (dots) (pagelist (- num 9) num current))
|
||||
:else (h/html (pagelist 1 2 current) (dots) (pagelist (- current 3) (+ current 3) current) (dots) (pagelist (- num 1) num current)))
|
||||
(page (inc current) (= current num) "disabled" (h/html "Weiter " [:span.fa.fa-arrow-right]))]]
|
||||
[:div.clearfix]))
|
||||
[:div.clearfix])))
|
||||
|
||||
(defn pagination-mobile [num current]
|
||||
(if (< num 2)
|
||||
""
|
||||
(h/html
|
||||
[:ul.pagination.justify-content-end.hidden-md-up
|
||||
(page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück"))
|
||||
|
@ -47,7 +51,7 @@
|
|||
[:select#page-switcher.form-control
|
||||
(for [p (range 1 (inc num))]
|
||||
[:option (cond-> {:value p} (= p current) (assoc :selected "selected")) p])]]
|
||||
(page (inc current) (= current num) "disabled" (h/html "Weiter " [:span.fa.fa-arrow-right]))]))
|
||||
(page (inc current) (= current num) "disabled" (h/html "Weiter " [:span.fa.fa-arrow-right]))])))
|
||||
|
||||
(defn index-page [current request]
|
||||
(let [image-count 25
|
||||
|
|
Loading…
Reference in a new issue