]> granicus.if.org Git - cgit/commitdiff
ui-repolist: Bold the currently viewed page.
authorJamie Couture <jamie.couture@gmail.com>
Mon, 8 Oct 2012 16:49:34 +0000 (12:49 -0400)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 8 Oct 2012 21:29:29 +0000 (23:29 +0200)
Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
cgit.css
ui-repolist.c

index 651a32004c9277bc1d423eeaebd409147c3654d1..54da076617aed6964d24b83e0f6ed1fcaea2e64f 100644 (file)
--- 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;
index 943eaab77995bc9ef8c8fd3c59e1503b0c210aae..46cbacfa7b520f6280302cdeffbd04609b5e1a18 100644 (file)
@@ -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>");
 }