[Catalyst-commits] r14128 - in trunk/examples/CatalystAdvent: . lib lib/CatalystAdvent/Controller

dpetrov at dev.catalyst.perl.org dpetrov at dev.catalyst.perl.org
Fri Oct 7 10:20:38 GMT 2011


Author: dpetrov
Date: 2011-10-07 10:20:38 +0000 (Fri, 07 Oct 2011)
New Revision: 14128

Modified:
   trunk/examples/CatalystAdvent/Changes
   trunk/examples/CatalystAdvent/Makefile.PL
   trunk/examples/CatalystAdvent/lib/CatalystAdvent.pm
   trunk/examples/CatalystAdvent/lib/CatalystAdvent/Controller/Calendar.pm
Log:
Resolve dependencies and fix displaying article list

Modified: trunk/examples/CatalystAdvent/Changes
===================================================================
--- trunk/examples/CatalystAdvent/Changes	2011-10-04 17:05:34 UTC (rev 14127)
+++ trunk/examples/CatalystAdvent/Changes	2011-10-07 10:20:38 UTC (rev 14128)
@@ -1,5 +1,9 @@
 This file documents the revision history for Perl extension CatalystAdvent.
 
+0.05
+        - Resolve dependencies
+        - Fix displaying article list
+
 0.04
         - Display article list with names underneath the calendar on the
           per-year page 

Modified: trunk/examples/CatalystAdvent/Makefile.PL
===================================================================
--- trunk/examples/CatalystAdvent/Makefile.PL	2011-10-04 17:05:34 UTC (rev 14127)
+++ trunk/examples/CatalystAdvent/Makefile.PL	2011-10-07 10:20:38 UTC (rev 14128)
@@ -11,7 +11,9 @@
 requires Catalyst => '5.90';
 requires 'Catalyst::Plugin::Unicode::Encoding';
 requires 'Catalyst::Plugin::Cache' => '0.08';
+requires 'Cache::FileCache';
 requires 'Catalyst::Plugin::Static::Simple';
+requires 'Catalyst::View::TT';
 requires 'DateTime';
 requires 'File::stat';
 requires 'Pod::Xhtml';
@@ -20,6 +22,8 @@
 requires 'HTTP::Date';
 requires 'List::Util';
 requires 'Template::Plugin::DateTime'; # EWWWWW
+requires 'Date::Calc';
+requires 'Catalyst::Action::RenderView';
 
 test_requires 'Test::More' => '0.88';
 

Modified: trunk/examples/CatalystAdvent/lib/CatalystAdvent/Controller/Calendar.pm
===================================================================
--- trunk/examples/CatalystAdvent/lib/CatalystAdvent/Controller/Calendar.pm	2011-10-04 17:05:34 UTC (rev 14127)
+++ trunk/examples/CatalystAdvent/lib/CatalystAdvent/Controller/Calendar.pm	2011-10-07 10:20:38 UTC (rev 14128)
@@ -66,7 +66,7 @@
 
     $c->detach( '/calendar/index' ) unless $year =~ /^\d{4}$/;
 
-    $c->res->redirect( $c->uri_for('/') )
+    $c->res->redirect( $c->uri_for('/') ) && $c->detach
         unless ( -d $c->path_to( 'root', $year ) );
 
     $c->stash->{year}     = $year;
@@ -75,12 +75,15 @@
     opendir my $DIR, $c->path_to('root', $year) or die "Error opening root: $!";
     my @days = sort { $a <=> $b }
                map  { m/(\d+)\.pod/ }
-               grep { /(\d+)\.pod/ && $1 <= $c->stash->{now}->day } 
                readdir $DIR;
     closedir $DIR;
-    
+
     my @links;
-    foreach my $day (@days) {
+    DAY: foreach my $day (@days) {
+        # Don't show link to articles before the appropriate day, even if they're ready
+        my $date = DateTime->new( day => $day, month => 12, year => $year );
+        next DAY if $c->stash->{now} < $date;
+
         my $file = $c->path_to( 'root', $year )->file( "$day.pod" );
 
         my $mtime        = ( stat $file )->mtime;

Modified: trunk/examples/CatalystAdvent/lib/CatalystAdvent.pm
===================================================================
--- trunk/examples/CatalystAdvent/lib/CatalystAdvent.pm	2011-10-04 17:05:34 UTC (rev 14127)
+++ trunk/examples/CatalystAdvent/lib/CatalystAdvent.pm	2011-10-07 10:20:38 UTC (rev 14128)
@@ -5,10 +5,10 @@
 
 use Catalyst qw( Static::Simple
                  Cache
-                 Unicode
+                 Unicode::Encoding
               );
 
-our $VERSION = '0.04';
+our $VERSION = '0.05';
 
 __PACKAGE__->config(
   name => 'CatalystAdvent',




More information about the Catalyst-commits mailing list