[Seaside] More S-Exprs
Jim Benson
jb@speed.net
Wed, 29 May 2002 13:56:44 -0700
Avi,
First, thanks for having the patience to answer these questions.
> On Wed, 29 May 2002, Jim Benson wrote:
>
> > <table>
> > <tr repeat="@app/apps">
> > <td><a href="@appLink" target="seasideapp">[app.key]</a></td>
> > <td><a href="@edit:">(edit)</a></td>
> > <td><a href="@remove:">(remove)</a></td>
> > </tr>
> > </table>
> >
> > How do you translate this?
>
> #(table
> (tr sea:id: 'app/apps'
> (td (a sea:id: appLink target: seasideapp '[app.key]'))
> (td (a sea:id: edit: '(edit)'))
> (td (a sea:id: remove: '(remove)'))))
>
> Out of curiosity, what was the hard part?
Not hard parts, just a total cloud of confusion:
First, I'm not far enough to have a full grasp of Seaside yet. For example
(and even though it's on the first page of the Seaside Design Overview ;-) I
couldn't see that you get a HTML element 'href=' out of
( a sea:id: edit: '(edit)')
In my naive attempts, I would try to do something like:
( a href: sea:id: 'edit:' '(edit)' )
This is all part of the learning curve.
Another hard part is the kind of 'magic' that the S-Expr brings. I would not
have gotten:
(tr sea:id: 'app/apps'
.... )
as a translation of
<tr repeat="@app/apps">
So I was doing something along the lines of:
( tr repeat: sea:id: 'app/apps' )
thinking that the "@app/apps" could be substituted by sea:id: 'app/apps',
when in fact it in addition replaces the previous term so that
repeat="@app/apps" becomes: sea:id: 'app/apps'
This is the same substitution as the <a href="@edit" , so it's beginning to
sink in. I think you told me this once before, but I didn't pay much
attention. I guess I needed another round of embarassment.
I'm glad I asked, thanks
Jim