List for cgit developers and users
 help / color / mirror / Atom feed
From: jamie.couture at gmail.com (Jamie Couture)
Subject: [PATCH] repolist pagination changes
Date: Sun, 13 Nov 2011 17:08:00 -0500	[thread overview]
Message-ID: <1321222080-5521-1-git-send-email-jamie.couture@gmail.com> (raw)

From: Jamie Couture <jamie.couture at gmail.com>

bold the current page we're viewing

Signed-off-by: Jamie Couture <jamie.couture at gmail.com>
---
 cgit.css      |    4 ++++
 ui-repolist.c |   11 +++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/cgit.css b/cgit.css
index 55afa94..a9946d6 100644
--- a/cgit.css
+++ b/cgit.css
@@ -550,6 +550,10 @@ div.pager a {
 	margin: 0em 0.5em;
 }
 
+div.pager .current {
+	font-weight: bold;
+}
+
 span.age-mins {
 	font-weight: bold;
 	color: #080;
diff --git a/ui-repolist.c b/ui-repolist.c
index 25c36ce..7619dcd 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -120,11 +120,14 @@ void print_header(int columns)
 
 void print_pager(int items, int pagelen, char *search)
 {
-	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, 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, ofs);
+	}
 	html("</div>");
 }
 
-- 
1.7.6





             reply	other threads:[~2011-11-13 22:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-13 22:08 jamie.couture [this message]
2012-01-04 17:44 ` [REROLL v2] jamie.couture
2012-01-04 17:44   ` [PATCH v2] repolist pagination changes jamie.couture
2012-09-27  1:39 Maintaining My Own Cgit Tree Jason
2012-10-08 16:49 ` [PATCH] repolist pagination changes jamie.couture
2012-10-08 21:39   ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321222080-5521-1-git-send-email-jamie.couture@gmail.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).