Starting to move git_header_html output into the template
Dan Brook [Thu, 6 Aug 2009 11:06:37 +0000 (12:06 +0100)]
Gitalist/templates/default.tt2
gitweb.cgi

index 10480b3..8c4332a 100644 (file)
@@ -7,7 +7,9 @@
 <meta http-equiv="content-type" content="[% content_type %]; charset=utf-8"/>
 <meta name="generator" content="gitweb/[% version %] git/[% git_version %][% mod_perl_version %]"/>
 <meta name="robots" content="index, nofollow"/>
-<title>[% title %]</title>
+<title>[% title %] (Gitalist)</title>
+[% baseurl %]
+[% FOREACH ss IN stylesheets; ss; END %]
 
 [% content %]
 
index 631a015..6def5b0 100755 (executable)
@@ -2945,19 +2945,18 @@ sub git_header_html {
 
        # the stylesheet, favicon etc urls won't work correctly with path_info
        # unless we set the appropriate base URL
-       if ($ENV{'PATH_INFO'}) {
-               print "<base href=\"".esc_url($base_url)."\" />\n";
-       }
+       $c->stash->{baseurl} = $ENV{PATH_INFO}
+                                                ? q[<base href="].esc_url($base_url).q[" />]
+                                                : '';
+
        # print out each stylesheet that exist, providing backwards capability
        # for those people who defined $stylesheet in a config file
-       if (defined $stylesheet) {
-               print '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'"/>'."\n";
-       } else {
-               foreach my $stylesheet (@stylesheets) {
-                       next unless $stylesheet;
-                       print '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'"/>'."\n";
-               }
-       }
+       my $ssfmt = q[<link rel="stylesheet" type="text/css" href="%s"/>];
+       $c->stash->{stylesheets} = [defined $stylesheet
+               ? sprintf($ssfmt, $stylesheet)
+               : map(sprintf($ssfmt, $_), grep $_, @stylesheets)
+       ];
+
        if (defined $project) {
                my %href_params = get_feed_info();
                if (!exists $href_params{'-title'}) {