all repos — cgit @ 4675b91211fe3119a0def539521ac759b3fb57d0

a hyperfast web frontend for git written in c

ui-repolist: Bold the currently viewed page.

Signed-off-by: Jamie Couture <jamie.couture@gmail.com>
Jamie Couture jamie.couture@gmail.com
Mon, 08 Oct 2012 12:49:34 -0400
commit

4675b91211fe3119a0def539521ac759b3fb57d0

parent

61d4147ea2d58c9d129a084be13ccec6ae18b4d5

2 files changed, 11 insertions(+), 4 deletions(-)

jump to
M cgit.csscgit.css

@@ -548,6 +548,10 @@ color: #777;

margin: 0em 0.5em; } +div#cgit div.pager .current { + font-weight: bold; +} + div#cgit span.age-mins { font-weight: bold; color: #080;
M ui-repolist.cui-repolist.c

@@ -123,11 +123,14 @@

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>"); }