diff --git a/src/clj/yenu/routes/core.clj b/src/clj/yenu/routes/core.clj index 171b841..629fa40 100644 --- a/src/clj/yenu/routes/core.clj +++ b/src/clj/yenu/routes/core.clj @@ -27,27 +27,31 @@ (for [p (range from (inc to))] (page p (= p current) "active" p))) (defn pagination [num current] - (h/html - [:nav.pull-right.clearfix {:aria-label "Page navigation"} - [:ul.pagination.hidden-sm-down - (page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück")) - (cond - (< num 13) (pagelist 1 num current) - (<= current 7) (h/html (pagelist 1 10 current) (dots) (pagelist (- num 1) num current)) - (>= 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])) + (if (< num 2) + "" + (h/html + [:nav.pull-right.clearfix {:aria-label "Page navigation"} + [:ul.pagination.hidden-sm-down + (page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück")) + (cond + (< num 13) (pagelist 1 num current) + (<= current 7) (h/html (pagelist 1 10 current) (dots) (pagelist (- num 1) num current)) + (>= 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]))) (defn pagination-mobile [num current] - (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")) - [:form.form-inline - [: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]))])) + (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")) + [:form.form-inline + [: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]))]))) (defn index-page [current request] (let [image-count 25