[Jifty-commit] r2135 - in jifty/branches/template-declare: .
examples/HelloKitty examples/HelloKitty/lib/HelloKitty
lib/Jifty/View/Declare
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sun Nov 12 04:50:06 EST 2006
Author: jesse
Date: Sun Nov 12 04:50:06 2006
New Revision: 2135
Modified:
jifty/branches/template-declare/ (props changed)
jifty/branches/template-declare/examples/HelloKitty/hellokitty
jifty/branches/template-declare/examples/HelloKitty/lib/HelloKitty/View.pm
jifty/branches/template-declare/examples/HelloKitty/var/jifty-server.pid
jifty/branches/template-declare/lib/Jifty/View/Declare/Handler.pm
jifty/branches/template-declare/lib/Jifty/View/Declare/Templates.pm
Log:
r44729 at pinglin: jesse | 2006-11-09 21:17:41 -0500
* Baby steps toward a usable T::D usage
Modified: jifty/branches/template-declare/examples/HelloKitty/hellokitty
==============================================================================
Binary files. No diff available.
Modified: jifty/branches/template-declare/examples/HelloKitty/lib/HelloKitty/View.pm
==============================================================================
--- jifty/branches/template-declare/examples/HelloKitty/lib/HelloKitty/View.pm (original)
+++ jifty/branches/template-declare/examples/HelloKitty/lib/HelloKitty/View.pm Sun Nov 12 04:50:06 2006
@@ -1,8 +1,10 @@
-
+use warnings;
+use strict;
package HelloKitty::View;
use base qw/Jifty::View::Declare::Templates/;
use Template::Declare::Tags;
+use Jifty::View::Declare::Templates;
template foo => sub {
html {
@@ -14,7 +16,7 @@
};
template content => sub {
- outs 'woot';
+ form { outs 'woot'};
};
Modified: jifty/branches/template-declare/examples/HelloKitty/var/jifty-server.pid
==============================================================================
--- jifty/branches/template-declare/examples/HelloKitty/var/jifty-server.pid (original)
+++ jifty/branches/template-declare/examples/HelloKitty/var/jifty-server.pid Sun Nov 12 04:50:06 2006
@@ -1 +1 @@
-2728
\ No newline at end of file
+13043
\ No newline at end of file
Modified: jifty/branches/template-declare/lib/Jifty/View/Declare/Handler.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/View/Declare/Handler.pm (original)
+++ jifty/branches/template-declare/lib/Jifty/View/Declare/Handler.pm Sun Nov 12 04:50:06 2006
@@ -15,7 +15,10 @@
my $self = shift;
my $package = shift;
my $template = shift;
- warn "Showing $package $template";
+ no warnings qw/redefine/;
+ local *{Jifty::Web::out} = sub { shift; my $out = shift; Template::Declare::Tags::outs( $out);};
+
+ local $Template::Declare::Tags::BUFFER;
print STDOUT ($package->show($template));
@@ -44,25 +47,28 @@
sub resolve_template {
- my $self = shift;
- my $templatename = shift; # like /admin/ui/new
-
-
- my @components = split('/',$templatename);
- my $template = pop @components;
+ my $self = shift;
+ my $templatename = shift; # like /admin/ui/new
+ my @components = split( '/', $templatename );
+ my $template = pop @components;
- my $package = $self->root_class; # join('::',$self->root_class, at components);
- warn "The user is looking for $package $template";
- #unless ($package->isa('Jifty::View::Declare::Templates')) { $self->log->error("$package (".$self->root_class." / $templatename) isn't a valid template package."); return undef; }
- unless ($package->has_template($template)) {
+ my $package
+ = $self->root_class; # join('::',$self->root_class, at components);
+ warn "The user is looking for $package $template";
+ unless ( $package->isa('Jifty::View::Declare::Templates') ) {
+ $self->log->error( "$package (" . $self->root_class . " / $templatename) isn't a valid template package." );
+ return undef;
+ }
+ warn "The package is $package -- $template";
+ unless ( $package->has_template($template) ) {
$self->log->error("$package has no template $template.");
return undef;
}
-
+
warn "Resolved $package -> $template";
- return ($package, $template);
+ return ( $package, $template );
}
Modified: jifty/branches/template-declare/lib/Jifty/View/Declare/Templates.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/View/Declare/Templates.pm (original)
+++ jifty/branches/template-declare/lib/Jifty/View/Declare/Templates.pm Sun Nov 12 04:50:06 2006
@@ -1,6 +1,22 @@
+use warnings;
+use strict;
package Jifty::View::Declare::Templates;
-sub x{}
+use base qw/Exporter/;
+use Template::Declare::Tags;
+
use base qw/Template::Declare/;
-#
+our @EXPORT = qw(form);
+
+
+sub form (&){
+ my $code = shift;
+
+
+ Jifty->web->form->start;
+ outs($code->());
+ Jifty->web->form->end;
+}
+
+
1;
More information about the Jifty-commit
mailing list