Update with latest fixes
[catagits/BackPAN-Web.git] / lib / BackPAN / Web.pm
index 87c332c..2aa5bbc 100644 (file)
@@ -375,6 +375,7 @@ sub search {
 dispatch {
     subdispatch sub () {
         $self->_build_request_obj_from($_[+PSGI_ENV]);
+        my $base_title = 'BackPAN.org';
         [
             sub (/) {
                 $self->html_response({ body => $self->index_page_content });
@@ -396,7 +397,8 @@ dispatch {
                 my $release_rs = $self->releases($_[1]);
                 if ( $release_rs->count ) {
                     my $body = $self->releases_page_content($release_rs)
-                        ->select('#nav-releases')->add_to_attribute(class => 'active');
+                        ->select('#nav-releases')->add_to_attribute(class => 'active')
+                       ->select('title')->replace_content(join q{ - }, 'Releases', $base_title);
                     return $self->html_response({ body => $body });
                 }
                 else {
@@ -411,7 +413,8 @@ dispatch {
                 my $dist_rs = $self->dists($_[1]);
                 if ( $dist_rs->count ) {
                     my $body = $self->dists_page_content($dist_rs)
-                        ->select('#nav-dists')->add_to_attribute(class => 'active');
+                        ->select('#nav-dists')->add_to_attribute(class => 'active')
+                       ->select('title')->replace_content(join q{ - }, 'Distributions', $base_title);
                     return $self->html_response({ body => $body });
                 }
                 else {
@@ -424,7 +427,8 @@ dispatch {
 
             sub ( /distribution/*|/distribution/*/ + ?* ) {
                 if ( my $dist = $self->get_dist($_[1]) ) {
-                    my $body = $self->dist_info_page_content($dist, $_[2]);
+                    my $body = $self->dist_info_page_content($dist, $_[2])
+                       ->select('title')->replace_content(join q{ - }, $self->format_dist_name($dist->name), $base_title);
                     return $self->html_response({ body => $body });
                 }
                 else {
@@ -438,7 +442,8 @@ dispatch {
             sub ( /authors|/authors/ + ?* ) {
                 if ( my $authors = $self->authors($_[1]) ) {
                     my $body = $self->authors_page_content($authors)
-                        ->select('#nav-authors')->add_to_attribute(class => 'active');
+                        ->select('#nav-authors')->add_to_attribute(class => 'active')
+                       ->select('title')->replace_content(join q{ - }, 'Authors', $base_title);
                     return $self->html_response({ body => $body });
                 }
                 else {
@@ -456,7 +461,8 @@ dispatch {
                     my $body = $self->dists_page_content($dist_rs)
                         ->select('#q')->add_to_attribute(
                             value => $query_str
-                        );
+                        )
+                       ->select('title')->replace_content(join q{ - }, 'Search', $base_title);
                     return $self->html_response({ body => $body });
                 }
                 else {
@@ -495,10 +501,10 @@ sub as_psgi_app {
             404 => 'root/html/error_404.html';
         enable 'HTTPExceptions';
         enable 'Head';
-        enable 'AccessLog',
-            format => 'combined',
-            logger => sub { get_logger('accesslog')->info(@_) };
-        enable 'Log4perl', conf => 'log/log.conf';
+        #enable 'AccessLog',
+        #    format => 'combined',
+        #    logger => sub { get_logger('accesslog')->info(@_) };
+        #enable 'Log4perl', conf => 'log/log.conf';
         $app;
     };
 }