[jifty-devel] Appending to nested regions

Todd Chapman todd at chaka.net
Thu Nov 22 13:36:38 EST 2007


On 11/19/07, Jesse Vincent <jesse at bestpractical.com> wrote:
> Todd Chapman wrote:
> > Hello all,
> >
> > I have 2 regions. The first has a form and appends to the second when
> > the form is submitted. This worked fine until both regions were
> > embedded in another region when I started using TabView. Now the form
> > region can't find it's sibling.
> >
> > Here is the form region:
> >
> > template useradd => sub {
> >     h3 {_("Add peeps:")}
> >     form {
> >         render_action( new_action( moniker => 'add_user', class => 'AddSanta'));
> >         form_submit( label => 'Add', onclick => { submit =>
> > 'add_user', region => 'users', append => '/user' } );
> >     }
> > };
> >
> >
> > Do I need to switch from the region argument to using element argument
> > and rely on CSS selection? What's the best way to do this? Thank!
>
> I believe the problem is that you're using explicit region names, rather
> than qualified region names. Code that, I think, does what you want:
>
>         Jifty->web->form->submit(
>             label  => _('Create'),
>             onlick => [
>                 {   submit => {
>                         action    => $create,
>                         arguments => {
>                             owner_id =>
>
> Jifty->web->current_user->user_object->email,
>                             accepted => 1,
>                         }
>                     }
>                 },
>                 {   refresh_self => 1,
>                     arguments =>
>                         { deadline => $deadline, project => $project }
>                 },
>                 {   element =>
>                         Jifty->web->current_region->parent->get_element(
>                         'div.list'),
>                     append => $self->fragment_for('view'),
>                     args   => {
>                         object_type => $object_type,
>                         id => { result_of => $create, name => 'id' },
>                     },
>                 },
>             ]
>         );
>
Jesse,

The Jifty->web->current_region->parent->get_element call seems
problematic though. Doesn't it make some assumptions about region
structure? I want my regions to be able to address each other, but not
by having to know where on the page they are.

Is there a cleaner way?

>
> >
> > -Todd
> > _______________________________________________
> > jifty-devel mailing list
> > jifty-devel at lists.jifty.org
> > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
> >
>
>
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>


More information about the jifty-devel mailing list