[Catalyst-commits] r12326 - in trunk/examples/SmallBoard: . lib/SmallBoard/Controller root/src/board

dhoss at dev.catalyst.perl.org dhoss at dev.catalyst.perl.org
Sun Dec 13 06:26:27 GMT 2009


Author: dhoss
Date: 2009-12-13 06:26:26 +0000 (Sun, 13 Dec 2009)
New Revision: 12326

Modified:
   trunk/examples/SmallBoard/lib/SmallBoard/Controller/Board.pm
   trunk/examples/SmallBoard/root/src/board/view.tt2
   trunk/examples/SmallBoard/smallboard.db
Log:
replies are now threaded.

Modified: trunk/examples/SmallBoard/lib/SmallBoard/Controller/Board.pm
===================================================================
--- trunk/examples/SmallBoard/lib/SmallBoard/Controller/Board.pm	2009-12-13 04:40:15 UTC (rev 12325)
+++ trunk/examples/SmallBoard/lib/SmallBoard/Controller/Board.pm	2009-12-13 06:26:26 UTC (rev 12326)
@@ -33,9 +33,12 @@
     my ($self, $c, $thread_id) = @_;
 
 	my $thread = $c->model('Board::Thread')->find($thread_id);
-
+    
 	if ($thread_id) {
-	    $c->stash( thread => $thread );
+	    $c->stash( 
+		    thread  => $thread,
+			replies =>  
+		);
 	} else {
 	    $c->error("No such thread");
 		$c->detach;

Modified: trunk/examples/SmallBoard/root/src/board/view.tt2
===================================================================
--- trunk/examples/SmallBoard/root/src/board/view.tt2	2009-12-13 04:40:15 UTC (rev 12325)
+++ trunk/examples/SmallBoard/root/src/board/view.tt2	2009-12-13 06:26:26 UTC (rev 12326)
@@ -2,3 +2,24 @@
 <h2>[% thread.title %]</h2>
 <div>[% thread.content %]</div>
 <div><a href="[% c.uri_for_action('board/reply', [thread.thread_id]) %]">reply</a></div>
+<p>Replies:</p>
+
+[% BLOCK replies %]
+[% DEFAULT recurse=0 %]
+<a href="[%c.uri_for_action('board/view', [ reply.thread_id ]) %]">[% reply.title %]</a> - <a href="[% c.uri_for_action('board/reply', [ reply.thread_id ] ) %]">post a reply</a>
+  [% IF recurse %]
+    [% FOR subreply IN reply.children %]
+      <ul>
+        <li>
+         [% INCLUDE replies reply = subreply %]
+        </li>
+      </ul>
+    [% END %]
+  [% END %]
+[% END %]
+
+<ul>
+[% FOR reply IN thread.children %]
+[% PROCESS replies recurse=1 %]
+[% END %]
+</ul>

Modified: trunk/examples/SmallBoard/smallboard.db
===================================================================
--- trunk/examples/SmallBoard/smallboard.db	2009-12-13 04:40:15 UTC (rev 12325)
+++ trunk/examples/SmallBoard/smallboard.db	2009-12-13 06:26:26 UTC (rev 12326)
@@ -1,8 +1,20 @@
-SQLite format 3   @                                                                          
   è Gè                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ]5{indexnested_idx_parent_idnestedCREATE INDEX nested_idx_parent_id ON nested (parent_id)6‚GtablenestednestedCREATE TABLE nested (
+SQLite format 3   @     $                                                                     
   è Gè                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ]5{indexnested_idx_parent_idnestedCREATE INDEX nested_idx_parent_id ON nested (parent_id)6‚GtablenestednestedCREATE TABLE nested (
   thread_id INTEGER PRIMARY KEY NOT NULL,
   title varchar NOT NULL,
   content text NOT NULL,
   parent_id int,
   path varchar NOT NULL
-)
   š ïÞÊš                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          . +7testing a replytesting a reply again2.1 testtest1.1  testtest2  testtest1
-   ê ûöðê                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
\ No newline at end of file
+)
    Ï ïÞÊš]ûº~Y9
ã¿“e9 û Ï                                                                                                                                                                   * %%#asdfasdfasdfasdfasdfasdf2.1.2.3.1.1< M%testing a realy reply to a replyasdfasdfasdf2.1.2.3.1* -%asdfasdfasdfasdfasdfasdfasdf
+2.1.2.3, -)asdfasdfasdfasdfasdfasdf asdfa
+2.1.2.4* -%asdfasdfasdfasdfasdfasdfasdf2.1.1.3"
 'adfasdfasdf asdfasdf
+2.1.2.5( 1adsfasdfasdfas dfasdf asdf
+2.1.2.2* -%asdfasdfasdfasdfasdfasdfasdf
+2.1.2.1
+ %nooderasdfasdfasdf2.1.2#	 3nudderjasdlfkjas;ldfjasdf2.3: ;7reply to reply to replyrepladfl;jkasdl;fasdf2.1.1.2? C9reply to a reply to a replytesting moar moar moar2.1.1.1` Mutesting a realy reply to a replytestina a replakjsfd;lkj asldfjals;dfkja;lsdfkj a;fd2.1.1; ;Atest a reply to a replytesting ar eply to a reply2.2. +7testing a replytesting a reply again2.1 testtest1.1  testtest2  testtest1
+   – ûöðêäÌÞÆØÒ®Àº´¨¢œ–                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
+
+
+

+
+
+	  
\ No newline at end of file




More information about the Catalyst-commits mailing list