about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJamie Couture <jamie.couture@gmail.com>2012-10-08 12:49:34 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2012-10-08 23:29:29 +0200
commit4675b91211fe3119a0def539521ac759b3fb57d0 (patch)
tree152e484c6a598a4e4d16c80cee0ce5975cfa7042
parentdo not write outside heap buffer (diff)
downloadcgit-pink-4675b91211fe3119a0def539521ac759b3fb57d0.tar.gz
cgit-pink-4675b91211fe3119a0def539521ac759b3fb57d0.zip
ui-repolist: Bold the currently viewed page.
Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
-rw-r--r--cgit.css4
-rw-r--r--ui-repolist.c11
2 files changed, 11 insertions, 4 deletions
diff --git a/cgit.css b/cgit.css
index 651a320..54da076 100644
--- a/cgit.css
+++ b/cgit.css
@@ -548,6 +548,10 @@ div#cgit div.pager a {
 	margin: 0em 0.5em;
 }
 
+div#cgit div.pager .current {
+	font-weight: bold;
+}
+
 div#cgit span.age-mins {
 	font-weight: bold;
 	color: #080;
diff --git a/ui-repolist.c b/ui-repolist.c
index 943eaab..46cbacf 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -123,11 +123,14 @@ void print_header(int columns)
 
 void print_pager(int items, int pagelen, char *search, char *sort)
 {
-	int i;
+	int i, ofs;
+	char *class = NULL;
 	html("<div class='pager'>");
-	for(i = 0; i * pagelen < items; i++)
-		cgit_index_link(fmt("[%d]", i+1), fmt("Page %d", i+1), NULL,
-				search, sort, i * pagelen);
+	for(i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) {
+		class = (ctx.qry.ofs == ofs) ? "current" : NULL;
+		cgit_index_link(fmt("[%d]", i+1), fmt("Page %d", i+1), class,
+				search, sort, ofs);
+	}
 	html("</div>");
 }