[Catalyst-commits] r7470 - / trunk/examples/TestBed/lib/TestBed/Controller trunk/examples/TestBed/root trunk/examples/TestBed/root/static/css trunk/examples/TestBed/root/static/js

zarquon at dev.catalyst.perl.org zarquon at dev.catalyst.perl.org
Sat Mar 8 11:27:26 GMT 2008


Author: zarquon
Date: 2008-03-08 11:27:26 +0000 (Sat, 08 Mar 2008)
New Revision: 7470

Added:
   trunk/examples/TestBed/root/1.tt
   trunk/examples/TestBed/root/2.tt
   trunk/examples/TestBed/root/3.tt
   trunk/examples/TestBed/root/4.tt
   trunk/examples/TestBed/root/static/css/2.css
   trunk/examples/TestBed/root/static/css/3.css
   trunk/examples/TestBed/root/static/js/1.js
   trunk/examples/TestBed/root/static/js/2.js
   trunk/examples/TestBed/root/static/js/3.js
   trunk/examples/TestBed/root/static/js/4.js
Modified:
   /
   trunk/examples/TestBed/lib/TestBed/Controller/Root.pm
   trunk/examples/TestBed/root/index.tt
   trunk/examples/TestBed/root/page.tt
Log:
 r12810 at zaphod:  kd | 2008-03-08 22:22:31 +1100
 yummy jquery tutorial



Property changes on: 
___________________________________________________________________
Name: svk:merge
   - 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:12808
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909
   + 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:12810
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909

Modified: trunk/examples/TestBed/lib/TestBed/Controller/Root.pm
===================================================================
--- trunk/examples/TestBed/lib/TestBed/Controller/Root.pm	2008-03-08 01:05:10 UTC (rev 7469)
+++ trunk/examples/TestBed/lib/TestBed/Controller/Root.pm	2008-03-08 11:27:26 UTC (rev 7470)
@@ -6,15 +6,26 @@
 
 __PACKAGE__->config->{namespace} = '';
 
-sub default : Private {
+sub default : Path {
     my ($self, $c) = @_;
     $c->res->status(404);
     $c->stash->{template} = '404.tt';
 }
 
-sub main_page :Path {
+sub index : Private {
+        my ($self, $c) = @_;
+        $c->forward('page');
+}
+
+sub page : Local {
     my ($self, $c) = @_;
-    $c->stash->{template} = 'index.tt';
+    if ( ! @{$c->req->args}) {
+        $c->stash->{template} = 'index.tt';
+    }
+    else {
+        my $tt = join ('',@{$c->req->args}). ".tt";
+        $c->stash->{template} = $tt;
+    }
 }
 
 sub end : ActionClass('RenderView') {}

Added: trunk/examples/TestBed/root/1.tt
===================================================================
--- trunk/examples/TestBed/root/1.tt	                        (rev 0)
+++ trunk/examples/TestBed/root/1.tt	2008-03-08 11:27:26 UTC (rev 7470)
@@ -0,0 +1,7 @@
+[% WRAPPER page.tt title = c.config.name  %]
+<div class="span-24"> <h1>Javascript testbed</h1>
+<a href="">boo!</a>
+</div>
+[% END %]
+
+

Added: trunk/examples/TestBed/root/2.tt
===================================================================
--- trunk/examples/TestBed/root/2.tt	                        (rev 0)
+++ trunk/examples/TestBed/root/2.tt	2008-03-08 11:27:26 UTC (rev 7470)
@@ -0,0 +1,12 @@
+[% WRAPPER page.tt title = c.config.name  %]
+<div class="span-24"> <h1>Javascript testbed</h1>
+<ol id='ol'>
+<li>this</li>
+<li>is</li>
+<li>a</li>
+<li>test</li>
+</ul>
+</div>
+[% END %]
+
+

Added: trunk/examples/TestBed/root/3.tt
===================================================================
--- trunk/examples/TestBed/root/3.tt	                        (rev 0)
+++ trunk/examples/TestBed/root/3.tt	2008-03-08 11:27:26 UTC (rev 7470)
@@ -0,0 +1,7 @@
+[% WRAPPER page.tt title = c.config.name  %]
+<div class="span-24"> <h1>Javascript testbed</h1>
+<div id="rating"></div>
+</div>
+[% END %]
+
+

Added: trunk/examples/TestBed/root/4.tt
===================================================================
--- trunk/examples/TestBed/root/4.tt	                        (rev 0)
+++ trunk/examples/TestBed/root/4.tt	2008-03-08 11:27:26 UTC (rev 7470)
@@ -0,0 +1,11 @@
+[% WRAPPER page.tt title = c.config.name  %]
+<div class="span-24"> <h1>Javascript testbed</h1>
+<ul>
+<li><a class='stuff' href="">foo</a></li>
+<li><a class='stuff' href="">bar</a></li>
+<li><a class='stuff' href="">baz</a></li>
+<li><a class='stuff' href="">cunt</a></li>
+</div>
+[% END %]
+
+

Modified: trunk/examples/TestBed/root/index.tt
===================================================================
--- trunk/examples/TestBed/root/index.tt	2008-03-08 01:05:10 UTC (rev 7469)
+++ trunk/examples/TestBed/root/index.tt	2008-03-08 11:27:26 UTC (rev 7470)
@@ -1,6 +1,20 @@
 [% WRAPPER page.tt title = c.config.name  %]
 <div class="span-24"> <h1>Javascript testbed</h1>
-<div id='boo'> boo! </div>
+<h2> Lesson 1 </h2>
+
+<p> First up we have this jquery tutorial <a
+href="http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery">
+from the jquery wiki.</a> Recommend using this in conjunction with <a
+href="http://www.getfirefox.com">Firefox</a> and <a
+href="http://getfirebug.com">Firebug</a>.  Also using <a href="http://code.google.com/p/blueprintcss/">blueprint css</a> to reduce typographical and layout pain
+
+<ul>
+<li><a href="[% c.uri_for('/page/1') %]"> Part 1 </a> </li>
+<li><a href="[% c.uri_for('/page/2') %]"> Part 2 </a> </li>
+<li><a href="[% c.uri_for('/page/3') %]"> Part 3 (parts unimplemented) </a> </li>
+<li><a href="[% c.uri_for('/page/4') %]"> Part 4 </a> </li>
+</ul>
+</p>
 </div>
 [% END %]
 

Modified: trunk/examples/TestBed/root/page.tt
===================================================================
--- trunk/examples/TestBed/root/page.tt	2008-03-08 01:05:10 UTC (rev 7469)
+++ trunk/examples/TestBed/root/page.tt	2008-03-08 11:27:26 UTC (rev 7470)
@@ -4,11 +4,11 @@
 <link rel="stylesheet" href="[% base %]static/css/blueprint/screen.css" type="text/css" media="screen, projection" />
 <link rel="stylesheet" href="[% base %]static/css/blueprint/print.css" type="text/css" media="print" />    
 <!-- [if IE]><link rel="stylesheet" href="[% base %]static/css/blueprint/ie.css" type="text/css" media="screen,  projection" /><![endif] -->
-<link rel="stylesheet" href="[% base %]static/css/site.css" type="text/css" media="screen, projection"/>    
-<script type="text/javascript" src="[% base  %]static/js/jquery.js" />
-<script type="text/javascript">                                         
- // js  here
-</script> 
+<link rel="stylesheet" href="[% base %]static/css/[% c.req.args.join('') %].css"" type="text/css" media="screen, projection"/>    
+<script type="text/javascript" src="[% base %]static/js/jquery.js" />
+
+<script type="text/javascript" src="[% base %]static/js/[% c.req.args.join('') %].js" />
+
 </head>
 <body>
 <div class="container">

Added: trunk/examples/TestBed/root/static/css/2.css
===================================================================
--- trunk/examples/TestBed/root/static/css/2.css	                        (rev 0)
+++ trunk/examples/TestBed/root/static/css/2.css	2008-03-08 11:27:26 UTC (rev 7470)
@@ -0,0 +1,3 @@
+.red {  background-color: red; }
+.blue {  background-color: blue; }
+.green {  background-color: green; }

Added: trunk/examples/TestBed/root/static/css/3.css
===================================================================

Added: trunk/examples/TestBed/root/static/js/1.js
===================================================================
--- trunk/examples/TestBed/root/static/js/1.js	                        (rev 0)
+++ trunk/examples/TestBed/root/static/js/1.js	2008-03-08 11:27:26 UTC (rev 7470)
@@ -0,0 +1,7 @@
+/* some listy stuff */
+
+$(document).ready(function() {
+ $("#orderedlist").addClass("red");
+        
+        
+});
\ No newline at end of file

Added: trunk/examples/TestBed/root/static/js/2.js
===================================================================
--- trunk/examples/TestBed/root/static/js/2.js	                        (rev 0)
+++ trunk/examples/TestBed/root/static/js/2.js	2008-03-08 11:27:26 UTC (rev 7470)
@@ -0,0 +1,13 @@
+$(document).ready(function() {
+        $("#ol").addClass("red");
+        $("#ol > li").addClass("blue");
+        $("#ol li:last").hover(function() {
+                $(this).addClass("green");
+            },function(){
+                $(this).removeClass("green");
+            });
+
+        $("#ol").find("li").each(function(i) {
+                $(this).append( " BAM! " + i );
+            });    
+    });
\ No newline at end of file

Added: trunk/examples/TestBed/root/static/js/3.js
===================================================================
--- trunk/examples/TestBed/root/static/js/3.js	                        (rev 0)
+++ trunk/examples/TestBed/root/static/js/3.js	2008-03-08 11:27:26 UTC (rev 7470)
@@ -0,0 +1,25 @@
+ $(document).ready(function() {
+   // generate markup
+   $("#rating").append("Please rate: ");
+   
+   for ( var i = 1; i <= 5; i++ )
+     $("#rating").append("<a href='#'>" + i + "</a> ");
+   
+   // add markup to container and apply click handlers to anchors
+   $("#rating a").click(function(e){
+     // send request
+     $.post("/rate", {rating: $(this).html()}, function(xml) {
+       // format and output result UNIMPLEMENTED - lets port it to
+       // JSON one day
+       $("#rating").html(
+         "Thanks for rating, current average: " +
+         $("average", xml).text() +
+         ", number of votes: " +
+         $("count", xml).text()
+       );
+     });
+     
+     // stop normal link click
+     return false;
+   });
+ });
\ No newline at end of file

Added: trunk/examples/TestBed/root/static/js/4.js
===================================================================
--- trunk/examples/TestBed/root/static/js/4.js	                        (rev 0)
+++ trunk/examples/TestBed/root/static/js/4.js	2008-03-08 11:27:26 UTC (rev 7470)
@@ -0,0 +1,7 @@
+$(document).ready(function(){
+   $("a").toggle(function(){
+     $(".stuff").animate({ height: 'hide', opacity: 'hide' }, 'slow');
+   },function(){
+     $(".stuff").animate({ height: 'show', opacity: 'show' }, 'slow');
+   });
+ });




More information about the Catalyst-commits mailing list