[aida] Newbie question

nicolas petton petton.nicolas at gmail.com
Thu Oct 18 17:40:09 CEST 2007


Le jeudi 18 octobre 2007 à 17:09 +0200, Janko Mivšek a écrit :
> Nicolas,
> 
> nicolas petton wrote:
> 
> > I'm working on a small blog engine, mostly to learn AIDA/Web.
> > 
> > I've got a Blog, and some posts.
> > In BlogApp>>viewMain, I want to display the posts :
> > 
> > BlogApp>>vewMain
> > 	|e|
> > 	e := WebElement new.
> > 	self observee posts do: [:each |
> > 		e add: (PostApp new observee: each)].
> > 	self pageFrameWith: e title: self observee title. 
> > 
> > It does not work (return halt).
> > What's wrong ?
> 
> e add: (PostApp new observee: each)
> 
> You don't need to make PostApp manually, it is automatically created 
> when you access that domain object for a first time. What you need is to 
> add a link to that domain object:
> 
> e addLinkTo: each text: eaxh title.
> 
> So, a whole viewMain would be:
> 
> BlogApp>>viewMain
>   	|e|
>   	e := WebElement new.
>   	self observee posts do: [:each |
>   		e addLinkTo: each text: each title.
> 		e addBreak].
>   	self pageFrameWith: e title: self observee title.
> 
Thank you Janko, but I want to display all posts, not links to them.
In PostApp>>viewMain I have :

viewMain
	|e|
	e := WebElement new.
	e addTextH1: self observee title.
	e addText: self observee contents.
	self pageFrameWith: e title: self observee title.

A solution would be to rewrite this in BlogApp>>viewMain in a block, but
I don't want to duplicate my code. That's why I wrote in
BlogApp>>viewMain "e add: (PostApp new observee: each)".

Nicolas
> Best regards
> Janko
> 
-- 
Nicolas Petton
http://nico.bioskop.fr
             ___
           ooooooo
          OOOOOOOOO
         |Smalltalk|
          OOOOOOOOO
           ooooooo
            \   /
             [|]
--------------------------------
Ma clé GPG est disponible ici :
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE788C34D

-------------- section suivante --------------
Une pi�ce jointe non texte a �t� nettoy�e...
Nom: non disponible
Type: application/pgp-signature
Taille: 189 octets
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url: http://lists.aidaweb.si/pipermail/aida/attachments/20071018/cb1d8b27/attachment.sig 


More information about the Aida mailing list