]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: common html_start method
authorEric Wong <e@80x24.org>
Tue, 12 Jan 2016 20:45:58 +0000 (20:45 +0000)
committerEric Wong <e@80x24.org>
Tue, 5 Apr 2016 18:58:27 +0000 (18:58 +0000)
We will want a common UI/UX for all repobrowse HTML pages.

lib/PublicInbox/RepoBrowseBase.pm

index 8e45bac8d3c923ef393ef037e5ad102faf39cdc8..2ff5680afe54e1302edbef71047b2c2ed6212589 100644 (file)
@@ -4,7 +4,7 @@ package PublicInbox::RepoBrowseBase;
 use strict;
 use warnings;
 require PublicInbox::RepoBrowseQuery;
-require PublicInbox::Hval;
+use PublicInbox::Hval;
 
 sub new { bless {}, shift }
 
@@ -53,4 +53,14 @@ sub mime_type {
        (defined($ct) && $ct =~ m!\A(?:image|audio|video)/!) ? $ct : undef;
 }
 
+# starts an HTML page for Repobrowse in a consistent way
+sub html_start {
+       my ($self, $req, $title_html) = @_;
+       my $desc = $req->{repo_info}->{desc_html};
+
+       "<html><head><title>$title_html</title>" .
+               PublicInbox::Hval::STYLE .
+               "</head><body><pre><b>$desc</b>";
+}
+
 1;