Permalink
Browse files

Made list of page numbers (in paginated search and all article result…

…s) prettier
  • Loading branch information...
1 parent cbb0590 commit 8afd60bcc0a7e7906ed3c00c5f94d6cdc945ceb5 @vsedach committed Dec 1, 2011
Showing with 19 additions and 28 deletions.
  1. +18 −13 src/search.lisp
  2. +1 −15 static/css/style.css
View
@@ -60,19 +60,24 @@
(defun paginate-article-summaries (start articles &optional (next-page-uri "?"))
(let ((page-size 10)
(start (or (parse-integer (or start "0") :junk-allowed t) 0)))
- #H[<ol start="${(1+ start)}">]
- (loop for i from start below (min (+ start page-size) (length articles))
- do (pprint-article-summary-li (elt articles i) "<br />"))
- #H[</ol>
- <div id="paginator">
- <span>Result page:</span>
- <ul>]
- (dotimes (p (ceiling (length articles) page-size))
- #H[<li>]
- (if (= start (* p page-size))
- #H[${(1+ p)}]
- #H[<a href="${next-page-uri}&start=${(* p page-size)}">${(1+ p)}</a></li>]))
- #H[</ul></div>]))
+ (flet ((page-uri (page# label)
+ #H[<span><a href="${next-page-uri}&start=${(* page# page-size)}">${label}</a></span>]))
+
+ #H[<ol start="${(1+ start)}">]
+ (loop for i from start below (min (+ start page-size) (length articles))
+ do (pprint-article-summary-li (elt articles i) "<br />"))
+ #H[</ol>
+ <div id="paginator">
+ <span>Result page:</span>]
+ (unless (= 0 start)
+ (page-uri (ceiling (- start page-size) page-size) "&lt;"))
+ (dotimes (page# (ceiling (length articles) page-size))
+ (if (= start (* page# page-size))
+ #H[<span>${(1+ page#)}</span>]
+ (page-uri page# (1+ page#))))
+ (unless (>= (+ start page-size) (length articles))
+ (page-uri (ceiling (+ start page-size) page-size) "&gt;"))
+ #H[</div>])))
(defpage /site/search "Search results" (query start)
#H[<h1>Search results</h1>]
View
@@ -167,28 +167,14 @@
color: #333;
background: #eee;
margin-top:20px;
- height:36px;
}
#paginator span {
- float:left;
+ display:inline-block;
font-style:oblique;
- line-height:36px;
margin-right:12px;
}
-#paginator ul {
- list-style: none;
- list-style-position: outside;
-}
-
-#paginator ul li {
- margin: 0;
- float: left;
- line-height:36px;
- padding: 0 12px;
-}
-
#content {
padding-top:15px;
padding-left:85px;

0 comments on commit 8afd60b

Please sign in to comment.