[Jifty-commit] r3028 - in jifty/trunk: lib/Jifty/View/Declare
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Mar 19 13:31:16 EDT 2007
Author: jesse
Date: Mon Mar 19 13:31:14 2007
New Revision: 3028
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/View/Declare/Helpers.pm
Log:
r53632 at pinglin: jesse | 2007-03-19 13:27:23 -0400
From: evdb at ecclestoad.co.uk
Subject: Re: [jifty-devel] 'smart_tag_wrapper' to make creating smarter tags easier
Date: March 19, 2007 11:36:20 AM EDT
To: jifty-devel at lists.jifty.org
Reply-To: jifty-devel at lists.jifty.org
On 19/03/07, Jesse Vincent <jesse at bestpractical.com> wrote:
I needed this tonight. Wanna make it go? ;)
On Mar 16, 2007, at 5:26 AM, Edmund von der Burg wrote:
I'd love to make it go but can't at the moment as I am not able to
connect to the net this week (except via a local libary machine that
is so crippled that it does not count).
The code at the start of this thread for 'form' works for me, please
add it as you see fit :)
Cheers,
Edmund
> Hello,
>
> I've just committed code to Template::Declare that should make it
> easier to create smarter wrappers in the templates - for example the
> 'form' wrapper. Please see the diff for the details.
>
> http://svn.jifty.org/index.cgi/jifty/revision/?rev=2989
>
> Using this the 'form' sub in J::V::Declare::Helpers would become:
>
> {
> no warnings qw/redefine/;
> sub form (&) {
> my $code = shift;
>
> smart_tag_wrapper {
> outs_raw( Jifty->web->form->start(@_) );
> $code->();
> outs_raw( Jifty->web->form->end );
> return '';
> };
> }
> }
>
>
> you could then call it like this (not tested properly):
>
> my $action = ...setup_action..;
> with( call => $next, name => "loginbox" ),
Modified: jifty/trunk/lib/Jifty/View/Declare/Helpers.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare/Helpers.pm (original)
+++ jifty/trunk/lib/Jifty/View/Declare/Helpers.pm Mon Mar 19 13:31:14 2007
@@ -25,22 +25,24 @@
=head2 form CODE
Takes a subroutine reference or block of perl as its only argument and renders it as a Jifty C<form>.
-Bug: you can't currently specify arguments to form->start.
=cut
-
-{
+ {
no warnings qw/redefine/;
sub form (&) {
my $code = shift;
- outs_raw( Jifty->web->form->start );
- $code->();
- outs_raw( Jifty->web->form->end );
- return '';
+
+ smart_tag_wrapper {
+ outs_raw( Jifty->web->form->start(@_) );
+ $code->();
+ outs_raw( Jifty->web->form->end );
+ return '';
+ };
}
-}
+ }
+
=head2 hyperlink
More information about the Jifty-commit
mailing list