From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5F8741FAB1; Thu, 28 Aug 2014 02:47:42 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Cc: Eric Wong Subject: [PATCH 4/5] feed: show permalink to home page Date: Thu, 28 Aug 2014 02:47:35 +0000 Message-Id: <1409194056-4735-4-git-send-email-e@80x24.org> X-Mailer: git-send-email 2.1.0.2.g6fb949a.dirty In-Reply-To: <1409194056-4735-1-git-send-email-e@80x24.org> References: <1409194056-4735-1-git-send-email-e@80x24.org> List-Id: This will make it easier to bookmark an index page with threading context. --- lib/PublicInbox/Feed.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index cf64517..1eaba6c 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -59,7 +59,7 @@ sub generate_html_index { my @messages; my $git = PublicInbox::GitCatFile->new($args->{git_dir}); - my $last = each_recent_blob($args, sub { + my ($first, $last) = each_recent_blob($args, sub { my $mime = do_cat_mail($git, $_[0]) or return 0; my $t = eval { str2time($mime->header('Date')) }; @@ -89,7 +89,7 @@ sub generate_html_index { Email::Address->purge_cache; - my $footer = nav_footer($args->{cgi}, $last, $feed_opts); + my $footer = nav_footer($args->{cgi}, $first, $last, $feed_opts); my $list_footer = $args->{footer}; $footer .= "\n" . $list_footer if ($footer && $list_footer); $footer = "
" . PRE_WRAP . "$footer" if $footer; @@ -99,21 +99,22 @@ sub generate_html_index { # private subs sub nav_footer { - my ($cgi, $last, $feed_opts) = @_; + my ($cgi, $first, $last, $feed_opts) = @_; $cgi or return ''; my $old_r = $cgi->param('r'); my $head = ' '; my $next = ' '; if ($last) { - $next = qq!next!; + $next = qq!next!; } if ($old_r) { $head = $cgi->path_info; - $head = qq!head!; + $head = qq!head!; } - my $atom = "{atomurl}\">atom"; - "$next $head $atom"; + my $atom = "{atomurl}\">atom"; + my $permalink = "permalink"; + "$next $head $atom $permalink"; } sub each_recent_blob { @@ -174,7 +175,7 @@ sub each_recent_blob { close $log; # we may EPIPE here # for pagination - $commits[-1]; + ($commits[0], $commits[-1]); } # private functions below -- EW