]> git.deb.at Git - deb/packages.git/commitdiff
html/show.tmpl: Improve Homepage link
authorFrank Lichtenheld <frank@lichtenheld.de>
Tue, 11 Sep 2007 23:46:49 +0000 (01:46 +0200)
committerFrank Lichtenheld <frank@lichtenheld.de>
Tue, 11 Sep 2007 23:46:49 +0000 (01:46 +0200)
Enclose in <ul> to make it more consistent with other links.
Use the word "Homepage" as the link and only note the hostname
(think slashdot).

Also fix the handling of the legacy Url field

lib/Packages/Dispatcher.pm
templates/html/show.tmpl

index e2b64ad0e409db45ff486fc630825a9dc0ec01a7..a360ddf3a467a51881e697f2027034308284c6d9 100755 (executable)
@@ -25,6 +25,7 @@ use warnings;
 use CGI;
 use POSIX;
 use File::Basename;
+use URI;
 use URI::Escape;
 use HTML::Entities;
 use Template;
@@ -332,6 +333,11 @@ Packages::CGI::init_url( $input, \%params, \%opts );
 
     $page_content{make_search_url} = sub { return &Packages::CGI::make_search_url(@_) };
     $page_content{make_url} = sub { return &Packages::CGI::make_url(@_) };
+    $page_content{extract_host} = sub { my $uri = URI->new($_[0]);
+                                        my $host = $uri->host;
+                                        $host .= ':'.$uri->port if $uri->port != $uri->default_port;
+                                        return $host;
+                                      };
     # needed to work around the limitations of the the FILTER syntax
     $page_content{html_encode} = sub { return HTML::Entities::encode_entities(@_,'<>&"') };
     $page_content{uri_escape} = sub { return URI::Escape::uri_escape(@_) };
index 794903ab190a1a0f11e8f20f016316b3cf2d034f..2be807156bee8bb0144325822c5cf0f96491c02b 100644 (file)
 [%- END -%]
 
 [% url = page.get_newest('url');
-   url = page.get_newest('homepage');
+   SET url = page.get_newest('homepage') IF page.get_newest('homepage');
    IF url %]
 <h3>External Resources:</h3>
-<p>Homepage: <a href="[% url | uri %]">[% url | html %]</a></p>
+<ul>
+<li><a href="[% url | uri %]">Homepage</a> [[% extract_host(url) %]]</li>
+</ul>
 [% END %]
 
 [% FOREACH sim IN similar %]