From: Jakub Narebski <jnareb@gmail.com>
To: Kevin Cernekee <cernekee@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: [PATCH 3/3 (alternate)] gitweb: Mark "atnight" author/committer times also for 'localtime'
Date: Fri, 18 Mar 2011 18:46:02 +0100 [thread overview]
Message-ID: <201103181846.04979.jnareb@gmail.com> (raw)
In-Reply-To: <64c70e95e767572e5be732dc7e17815b@localhost>
From: Kevin Cernekee <cernekee@gmail.com>
By default, with 'localtime' feature disabled, the dates in 'commit',
'commitdiff' and 'tag' views show both GMT time, and localtime in
recorded author/committer/tagger timezone, marking localtime with
"atnight" class to notify times between 0 and 6 AM local time.
An example output can look like this:
author A U Thor <author@example.com>
Wed, 16 Mar 2011 07:02:42 +0000 (02:02 -0500)
^^^^^
where underlined part is marked with "atnight" class (in red with
default stylesheet).
If $feature{'localtime'} is enabled, we display the RFC 2822 date/time
in the author's/committer's/tagger's local timezone; previous commit
removed marking "atnight" times, because there wasn't separate local
time to mark up after GMT time.
This commit makes gitweb mark _whole_ RFC 2822 date/time with
"atnight" class for times between 0 and 6 AM.
An example output can look like this:
author A U Thor <author@example.com>
Wed, 16 Mar 2011 02:02:42 -0500
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
where again underlined part is marked with "atnight".
We probably should mark only time part of RFC 2822 date/time with
"atnight" class, but such solution would be more involved.
While at it fix whitespace, using spaces for align, tabs for indent.
NOTE that git_print_authorship subroutine is for now left as is; there
is no caller in gitweb that uses it with -localtime=>1.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Kevin, how about something like this instead? This preserves _intent_
for why there is local time beside GMT time when 'localtime' is disabled
better, I think.
Junio and Kevin, I am not sure if authorship should remain with Kevin,
or should it revert to me; the solution is quite different.
About no-change to git_print_authorship: alternate solution would be
to remove support for -localtime option, like in original patches.
gitweb/gitweb.perl | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index cdc2a96..5bda0a8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4003,15 +4003,23 @@ sub git_print_authorship_rows {
my %wd = parse_date($co->{"${who}_epoch"}, $co->{"${who}_tz"});
print "<tr><td>$who</td><td>" .
format_search_author($co->{"${who}_name"}, $who,
- esc_html($co->{"${who}_name"})) . " " .
+ esc_html($co->{"${who}_name"})) . " " .
format_search_author($co->{"${who}_email"}, $who,
- esc_html("<" . $co->{"${who}_email"} . ">")) .
+ esc_html("<" . $co->{"${who}_email"} . ">")) .
"</td><td rowspan=\"2\">" .
git_get_avatar($co->{"${who}_email"}, -size => 'double') .
"</td></tr>\n" .
"<tr>" .
- "<td></td><td> $wd{'rfc2822'}";
- print_local_time(%wd) if !gitweb_check_feature('localtime');
+ "<td></td><td> ";
+ if (gitweb_check_feature('localtime')) {
+ if ($wd{'hour_local'} < 6) {
+ print "<span class=\"atnight\">$wd{'rfc2822'}</span>";
+ } else {
+ print $wd{'rfc2822'};
+ }
+ } else {
+ print $wd{'rfc2822'} . format_local_time(%wd);
+ }
print "</td>" .
"</tr>\n";
}
--
1.7.3
next prev parent reply other threads:[~2011-03-18 17:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-17 19:38 [PATCH v2 1/3] gitweb: fix #patchNN anchors when path_info is enabled Kevin Cernekee
2011-03-17 19:38 ` [PATCH v2 2/3] gitweb: introduce localtime feature Kevin Cernekee
2011-03-18 14:40 ` [PATCH v3 " Jakub Narebski
2011-03-18 18:24 ` Junio C Hamano
2011-03-18 21:58 ` Jakub Narebski
2011-03-18 22:42 ` Junio C Hamano
2011-03-17 19:38 ` [PATCH 3/3] gitweb: show alternate author/committer times Kevin Cernekee
2011-03-18 17:46 ` Jakub Narebski [this message]
2011-03-18 19:07 ` [PATCH 3/3 (alternate)] gitweb: Mark "atnight" author/committer times also for 'localtime' Kevin Cernekee
2011-03-18 20:48 ` Junio C Hamano
2011-03-18 22:28 ` Jakub Narebski
2011-03-19 1:25 ` Junio C Hamano
2011-03-18 12:59 ` [PATCH v3 1/3] gitweb: fix #patchNN anchors when path_info is enabled Jakub Narebski
2011-03-18 15:25 ` Kevin Cernekee
2011-03-18 16:00 ` [PATCH v3 (amend) " Jakub Narebski
2011-03-18 16:57 ` [PATCH v3 " Junio C Hamano
2011-03-18 17:18 ` 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=201103181846.04979.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=cernekee@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).