From: Jakub Narebski <jnareb@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "J.H." <warthog9@kernel.org>,
Jonathan Nieder <jrnieder@gmail.com>,
git@vger.kernel.org, admin@repo.or.cz
Subject: [PATCH 2/1] gitweb: Mark matched 'ctag' / contents tag (?by_tag=foo)
Date: Wed, 9 Mar 2011 15:04:59 +0100 [thread overview]
Message-ID: <201103091505.03045.jnareb@gmail.com> (raw)
In-Reply-To: <201103071900.16126.jnareb@gmail.com>
It might have been hard to discover that current view is limited to
projects with given content tag (ctag), as it was distinquished only
in gitweb URL. Mark matched contents tag in the tag cloud using
"match" class, for easier discovery.
This commit introduces a bit of further code duplication in
git_populate_project_tagcloud().
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.perl | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 4d80818..7ba8a72 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2645,6 +2645,7 @@ sub git_populate_project_tagcloud {
}
my $cloud;
+ my $matched = $cgi->param('by_tag');
if (eval { require HTML::TagCloud; 1; }) {
$cloud = HTML::TagCloud->new;
foreach my $ctag (sort keys %ctags_lc) {
@@ -2654,17 +2655,22 @@ sub git_populate_project_tagcloud {
$title =~ s/ / /g;
$title =~ s/^/ /g;
$title =~ s/$/ /g;
+ if (defined $matched && $matched eq $ctag) {
+ $title = qq(<span class="match">$title</span>);
+ }
$cloud->add($title, href(project=>undef, ctag=>$ctag),
$ctags_lc{$ctag}->{count});
}
} else {
$cloud = {};
foreach my $ctag (keys %ctags_lc) {
- my $title = $ctags_lc{$ctag}->{topname};
+ my $title = esc_html($ctags_lc{$ctag}->{topname}, -nbsp=>1);
+ if (defined $matched && $matched eq $ctag) {
+ $title = qq(<span class="match">$title</span>);
+ }
$cloud->{$ctag}{count} = $ctags_lc{$ctag}->{count};
$cloud->{$ctag}{ctag} =
- $cgi->a({-href=>href(project=>undef, ctag=>$ctag)},
- esc_html($title, -nbsp=>1));
+ $cgi->a({-href=>href(project=>undef, ctag=>$ctag)}, $title);
}
}
return $cloud;
--
1.7.3
next prev parent reply other threads:[~2011-03-09 14:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20110301190229.11297.17767.reportbug@cassiopeia.kleinek>
2011-03-01 22:21 ` gitweb: cloud tags feature produces malformed XML for errors Jonathan Nieder
2011-03-02 0:05 ` Jakub Narebski
2011-03-02 8:24 ` Jakub Narebski
2011-03-02 8:45 ` Uwe Kleine-König
2011-03-02 1:06 ` J.H.
2011-03-02 21:18 ` Jakub Narebski
2011-03-02 21:55 ` Uwe Kleine-König
2011-03-03 0:42 ` Jakub Narebski
2011-03-03 8:19 ` Uwe Kleine-König
2011-03-07 18:00 ` [RFC/PATCH] gitweb: Change the way "content tags" ('ctags') are handled Jakub Narebski
2011-03-09 14:04 ` Jakub Narebski [this message]
2011-03-09 14:09 ` [PATCH 2/1] gitweb: Mark matched 'ctag' / contents tag (?by_tag=foo) Petr Baudis
2011-06-09 7:08 ` [PATCH] gitweb: do misparse nonnumeric content tag files that contain a digit Jonathan Nieder
2011-06-09 7:11 ` Jonathan Nieder
2011-03-03 11:58 ` gitweb: cloud tags feature produces malformed XML for errors Petr Baudis
2011-03-03 13:29 ` Jakub Narebski
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=201103091505.03045.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=admin@repo.or.cz \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=warthog9@kernel.org \
/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).