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,27 +27,31 @@
|
||||||
(for [p (range from (inc to))] (page p (= p current) "active" p)))
|
(for [p (range from (inc to))] (page p (= p current) "active" p)))
|
||||||
|
|
||||||
(defn pagination [num current]
|
(defn pagination [num current]
|
||||||
(h/html
|
(if (< num 2)
|
||||||
[:nav.pull-right.clearfix {:aria-label "Page navigation"}
|
""
|
||||||
[:ul.pagination.hidden-sm-down
|
(h/html
|
||||||
(page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück"))
|
[:nav.pull-right.clearfix {:aria-label "Page navigation"}
|
||||||
(cond
|
[:ul.pagination.hidden-sm-down
|
||||||
(< num 13) (pagelist 1 num current)
|
(page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück"))
|
||||||
(<= current 7) (h/html (pagelist 1 10 current) (dots) (pagelist (- num 1) num current))
|
(cond
|
||||||
(>= current (- num 6)) (h/html (pagelist 1 2 current) (dots) (pagelist (- num 9) num current))
|
(< num 13) (pagelist 1 num current)
|
||||||
:else (h/html (pagelist 1 2 current) (dots) (pagelist (- current 3) (+ current 3) current) (dots) (pagelist (- num 1) num current)))
|
(<= current 7) (h/html (pagelist 1 10 current) (dots) (pagelist (- num 1) num current))
|
||||||
(page (inc current) (= current num) "disabled" (h/html "Weiter " [:span.fa.fa-arrow-right]))]]
|
(>= current (- num 6)) (h/html (pagelist 1 2 current) (dots) (pagelist (- num 9) num current))
|
||||||
[:div.clearfix]))
|
: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])))
|
||||||
|
|
||||||
(defn pagination-mobile [num current]
|
(defn pagination-mobile [num current]
|
||||||
(h/html
|
(if (< num 2)
|
||||||
[:ul.pagination.justify-content-end.hidden-md-up
|
""
|
||||||
(page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück"))
|
(h/html
|
||||||
[:form.form-inline
|
[:ul.pagination.justify-content-end.hidden-md-up
|
||||||
[:select#page-switcher.form-control
|
(page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück"))
|
||||||
(for [p (range 1 (inc num))]
|
[:form.form-inline
|
||||||
[:option (cond-> {:value p} (= p current) (assoc :selected "selected")) p])]]
|
[:select#page-switcher.form-control
|
||||||
(page (inc current) (= current num) "disabled" (h/html "Weiter " [:span.fa.fa-arrow-right]))]))
|
(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]))])))
|
||||||
|
|
||||||
(defn index-page [current request]
|
(defn index-page [current request]
|
||||||
(let [image-count 25
|
(let [image-count 25
|
||||||
|
|
Loading…
Reference in a new issue