[Bast-commits] r8106 - in ironman/IronMan-Web: . lib/IronMan/Web/Controller root root/inc

fade at dev.catalyst.perl.org fade at dev.catalyst.perl.org
Mon Dec 14 16:06:55 GMT 2009


Author: fade
Date: 2009-12-14 16:06:55 +0000 (Mon, 14 Dec 2009)
New Revision: 8106

Modified:
   ironman/IronMan-Web/ironman_web.yml
   ironman/IronMan-Web/lib/IronMan/Web/Controller/Root.pm
   ironman/IronMan-Web/root/inc/post_teaser.tt
   ironman/IronMan-Web/root/index.tt
Log:
link to older post on the front page

Modified: ironman/IronMan-Web/ironman_web.yml
===================================================================
--- ironman/IronMan-Web/ironman_web.yml	2009-12-13 12:04:48 UTC (rev 8105)
+++ ironman/IronMan-Web/ironman_web.yml	2009-12-14 16:06:55 UTC (rev 8106)
@@ -2,3 +2,5 @@
 name: IronMan::Web
 
 default_view: TT
+
+frontpage_entries: 20

Modified: ironman/IronMan-Web/lib/IronMan/Web/Controller/Root.pm
===================================================================
--- ironman/IronMan-Web/lib/IronMan/Web/Controller/Root.pm	2009-12-13 12:04:48 UTC (rev 8105)
+++ ironman/IronMan-Web/lib/IronMan/Web/Controller/Root.pm	2009-12-14 16:06:55 UTC (rev 8106)
@@ -45,9 +45,17 @@
 sub index :Path :Args(0) {
     my ( $self, $c ) = @_;
 
-    my $posts = $c->model('FeedDB::Post')->search({},{'order_by' => \'posted_on DESC', 'rows' => 21 });
+    my $posts = $c->model('FeedDB::Post')->search({},{
+        'order_by' => \'posted_on DESC',
+        'rows' => $c->config->{'frontpage_entries'} + 1,
+        });
     $c->stash( 'posts' => $posts );
-
+    
+    my $next_post = ($posts->all)[-1];
+    
+    my $next_post_url = $next_post->posted_on->strftime('archive/%Y/%m/%d#') . $next_post->post_id;
+    
+    $c->stash( 'older_url' => $next_post_url );
 }
 
 =head2 new_feed

Modified: ironman/IronMan-Web/root/inc/post_teaser.tt
===================================================================
--- ironman/IronMan-Web/root/inc/post_teaser.tt	2009-12-13 12:04:48 UTC (rev 8105)
+++ ironman/IronMan-Web/root/inc/post_teaser.tt	2009-12-14 16:06:55 UTC (rev 8106)
@@ -1,3 +1,4 @@
+      <a name="[% post.post_id %]"></a>
       <div class="entry">
         <div class="entry-header">
           <div class="entry-title">
@@ -9,7 +10,7 @@
               <span class="entry-by-line">by <span class="entry-author">[% post.author %]</span></span>
             [% END %]
 
-            [% IF post.tags.size > 0 %]
+            [% IF post.tags AND post.tags.size > 0 %]
             <span class="entry-tags">
               on
               [% FOREACH tag IN post.tags -%]

Modified: ironman/IronMan-Web/root/index.tt
===================================================================
--- ironman/IronMan-Web/root/index.tt	2009-12-13 12:04:48 UTC (rev 8105)
+++ ironman/IronMan-Web/root/index.tt	2009-12-14 16:06:55 UTC (rev 8106)
@@ -5,4 +5,6 @@
     post = post
 %]
     
-[% END %]
\ No newline at end of file
+[% END %]
+
+<p><a href="[% older_url %]">Older posts &gt;</a></p>
\ No newline at end of file




More information about the Bast-commits mailing list