[Jifty-commit] r4830 - in jifty/trunk: . examples/Chat
examples/Chat/lib/Chat
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sat Jan 12 16:41:48 EST 2008
Author: jesse
Date: Sat Jan 12 16:41:48 2008
New Revision: 4830
Added:
jifty/trunk/examples/Chat/lib/Chat/View.pm
Removed:
jifty/trunk/examples/Chat/share/
Modified:
jifty/trunk/ (props changed)
jifty/trunk/examples/Chat/Makefile.PL
Log:
r74889 at pinglin: jesse | 2008-01-12 14:19:31 -0600
* Port the chat demo to Template::Declare
Modified: jifty/trunk/examples/Chat/Makefile.PL
==============================================================================
--- jifty/trunk/examples/Chat/Makefile.PL (original)
+++ jifty/trunk/examples/Chat/Makefile.PL Sat Jan 12 16:41:48 2008
@@ -1,5 +1,5 @@
use inc::Module::Install;
-name('Clock');
+name('Chat');
version('0.01');
requires('Jifty' => '0.60912');
Added: jifty/trunk/examples/Chat/lib/Chat/View.pm
==============================================================================
--- (empty file)
+++ jifty/trunk/examples/Chat/lib/Chat/View.pm Sat Jan 12 16:41:48 2008
@@ -0,0 +1,31 @@
+use warnings;
+use strict;
+
+package Chat::View;
+use Jifty::View::Declare -base;
+
+template 'index.html' => page { title => "Jifty chat server" } content {
+ Jifty->subs->add(
+ class => 'Message',
+ mode => 'Bottom',
+ region => "message",
+ render_with => '/fragments/message'
+ );
+ render_region( name => "message", path => '/__jifty/empty' );
+ render_region( name => "sender", path => '/fragments/sender' );
+};
+
+template 'fragments/message' => sub {
+ div { get('event')->data->{'message'} }
+};
+
+
+template 'fragments/sender' => sub {
+ my $action = Jifty->web->new_action( class => 'Send' );
+ form {
+ render_param ($action => 'message', focus => 1);
+ form_submit(onclick => [ { submit => $action }, { refresh_self => 1 } ]);
+ }
+};
+
+1;
More information about the Jifty-commit
mailing list