[jifty-devel] Re: [Jifty-commit] r3177 - jifty/trunk/lib/Jifty/Web/Form

Agostini yves agostini at univ-metz.fr
Mon Apr 30 12:31:15 EDT 2007


Le lundi 30 avril 2007 à 11:58 -0400,
jifty-commit at diesel.bestpractical.com a écrit : 
> Any reason not to lift this so that 'beforeclick' is at the same  
> level as 'onclick'?

as 'confirm', the beforeclick code must appear just before 'return
update (...)'
to be in same level 'beforeclick' need to be an action, isn't it ?
so it will be necessary to extract this action and make some special
things .. I will try later.
I want to make before a plugin with Wyzz to have a simple wyziwig online
editor on textarea.


> On Apr 30, 2007, at 11:55 AM, jifty-commit at lists.jifty.org wrote:
> 
> > Author: yves
> > Date: Mon Apr 30 11:55:39 2007
> > New Revision: 3177
> >
> > Modified:
> >    jifty/trunk/lib/Jifty/Web/Form/Element.pm
> >
> > Log:
> > add the ability to have some code before a javascript click :
> >    onclick => [ { beforeclick => "<somecode>;" }, { args => ...
> >
> >
> > Modified: jifty/trunk/lib/Jifty/Web/Form/Element.pm
> > ====================================================================== 
> > ========
> > --- jifty/trunk/lib/Jifty/Web/Form/Element.pm	(original)
> > +++ jifty/trunk/lib/Jifty/Web/Form/Element.pm	Mon Apr 30 11:55:39 2007
> > @@ -111,6 +111,10 @@
> >  A hashref of arguments to pass to the effect when it is created.   
> > These
> >  can be used to change the duration of the effect, for instance.
> >
> > +=item beforeclick => STRING
> > +
> > +String contains some Javascript code to be used before a click.
> > +
> >  =item confirm => STRING
> >
> >  Prompt the user with a Javascript confirm dialog with the given text
> > @@ -234,6 +238,7 @@
> >          my @fragments;
> >          my %actions;    # Maps actions => disable?
> >          my $confirm;
> > +        my $beforeclick;
> >
> >          for my $hook (grep {ref $_ eq "HASH"} (@{$value})) {
> >
> > @@ -254,6 +259,11 @@
> >                  $confirm = $hook->{confirm};
> >              }
> >
> > +            # Some code usable before onclick
> > +            if ($hook->{beforeclick}) {
> > +                $beforeclick = $hook->{beforeclick};
> > +            }
> > +
> >              # Placement
> >              if (exists $hook->{append}) {
> >                  @args{qw/mode path/} = ('Bottom', $hook->{append});
> > @@ -315,6 +325,9 @@
> >          if ($confirm) {
> >              $string = Jifty->web->escape("if(!confirm(" .  
> > Jifty::JSON::objToJson($confirm, {singlequote => 1}) . "))  
> > { Event.stop(event); return false }") . $string;
> >          }
> > +        if ($beforeclick) {
> > +           $string = Jifty->web->escape($beforeclick) . $string;
> > +        }
> >          $response .= qq| $trigger="$string"|;
> >      }
> >      return $response;
> > _______________________________________________
> > Jifty-commit mailing list
> > Jifty-commit at lists.jifty.org
> > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-commit
> >
> 
> _______________________________________________
> Jifty-commit mailing list
> Jifty-commit at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-commit
-- 
Agostini yves <agostini at univ-metz.fr>



More information about the jifty-devel mailing list