Re: [Factor-talk] Chloe call-next-template

2010-02-11 Thread Slava Pestov
Hi Alex,

The reason you can't do what you want to do is that both the
boilerplate and action responders call begin-form at the top of their
call-responder* methods.

Chloe forms are built on top of actions and the machinery in the
html.forms vocabulary. Nesting forms is supported only to the extent
that validation errors work properly for a page with multiple forms.
For example, in the pastebin, a Chloe template renders the actual
paste, and there is a sub-template with the form for adding an
annotation. Validation errors in the annotation form appear on the
annotation template's components, instead of on components of the same
name in the paste template.

To support what you want to do, the templating code needs to be
extended to support nested templates in a more advanced way. In
particular, Chloe tags for placing components need to be able to
address values from parent forms as well as child forms, using some
kind of namespacing syntax.

If that's a project you feel like taking on, let me know ;-)

Slava

On Thu, Feb 11, 2010 at 7:09 PM, Alex Drummond
a.d.drumm...@googlemail.com wrote:
 Hi,

 I've noticed that values from the parent template don't seem to be
 available to a child template rendered via t:call-next-template. I
 would like to render a list of records, with the html template for
 each record in a separate template file. Could anyone tell me the best
 way to do this with Chloe? The child template is also used to render
 individual records in other contexts, so I'd really like to keep it in
 its own file.

 thanks,
 Alex

 --
 SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Chloe call-next-template

2010-02-11 Thread Alex Drummond
Hey Slava, thanks for the helpful response.

Yes, I might see if I can extend the code a little. I guess there are
roughly two ways of doing it. Either (i) chloe templates have access
to data from parent forms by default (i.e. you can write t:label
t:name=parent.parent.foo /) or (ii) templates continue to operate
in a flat namespace, but there is a means of accessing values from
parent forms in factor controller code. In the case of (ii), you would
manually copy those values of interest into the child template's
namespace in the init quotation (or wherever).

Do you have any view on which (if either) is the better approach? I
guess there would also be issues regarding where validation errors
live. I haven't made much use of the validations system yet so I don't
have any ideas about how this would work.

For the moment, I think I will just generate the list XML in factor
using the child template, then bung the generated XML into the parent
template. I hadn't thought of doing this when I originally posted, but
it seems like an ok workaround.

Alex

On 11 February 2010 07:23, Slava Pestov sl...@factorcode.org wrote:
 Hi Alex,

 The reason you can't do what you want to do is that both the
 boilerplate and action responders call begin-form at the top of their
 call-responder* methods.

 Chloe forms are built on top of actions and the machinery in the
 html.forms vocabulary. Nesting forms is supported only to the extent
 that validation errors work properly for a page with multiple forms.
 For example, in the pastebin, a Chloe template renders the actual
 paste, and there is a sub-template with the form for adding an
 annotation. Validation errors in the annotation form appear on the
 annotation template's components, instead of on components of the same
 name in the paste template.

 To support what you want to do, the templating code needs to be
 extended to support nested templates in a more advanced way. In
 particular, Chloe tags for placing components need to be able to
 address values from parent forms as well as child forms, using some
 kind of namespacing syntax.

 If that's a project you feel like taking on, let me know ;-)

 Slava

 On Thu, Feb 11, 2010 at 7:09 PM, Alex Drummond
 a.d.drumm...@googlemail.com wrote:
 Hi,

 I've noticed that values from the parent template don't seem to be
 available to a child template rendered via t:call-next-template. I
 would like to render a list of records, with the html template for
 each record in a separate template file. Could anyone tell me the best
 way to do this with Chloe? The child template is also used to render
 individual records in other contexts, so I'd really like to keep it in
 its own file.

 thanks,
 Alex

 --
 SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk


 --
 SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] website

2010-02-11 Thread Hugh Aguilar
Over on http://www.forthwiki.com I set up a forum devoted to Factor.

This forum allows people to attach programs to their posts and/or to upload 
programs into the gallery. The idea is that people can post Factor programs 
here, to make them public. These would be programs that aren't general-purpose 
enough to be included with the Factor compiler, but which the author still 
wants to make public. This website would be an alternative to git-hub as a 
place to post programs.

On this same forum I have my slide-rule program in the gallery. This program is 
actually written in Forth rather than Factor. It is an example of the kind of 
program that can be posted to this website though. Such a program, written in 
Factor, wouldn't be appropriate for inclusion with the Factor compiler because 
it is not general-purpose. On the other hand though, it is BSD-license and is 
intended to be made available to the public.

The forum also allows people to start discussion threads. In some cases people 
will want to discuss particular Factor programs in detail, and this would tend 
to clutter up the Factor mailing-list as most of the readers wouldn't be 
interested in that program. Such discussions can be diverted to forthwiki to 
leave the Factor mailing-list clear for general-purpose discussions.

I hope that this forum turns out to be useful to the Factor community. I'm 
certainly not competing against this mailing-list as a support center for 
Factor --- my forum over there is intended to be an extension of what is going 
on over here. 


  --
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk