[Nitro] accessing children within an element

Jimmy Jazz Jimmy.Jazz at gmx.net
Fri Jul 6 17:15:09 EDT 2007


I took some time to discover why it was not possible to access a child
content from within an element :)

The instance variable @_children should have been declared as a class
variable @@_children. Otherwise you will lose what you have filled in
after calling the method add_child in

Also, i'm a bit confused about how to use it.

If you write something like,

<Box id="mybox">

and you declare a class Box

Class Page
Class Box < Raw::Element
    <div id="mylayout">
     Oh Jack ...

the layout mylayout of the class Box  will be completely ignored if you
call the child "mybox" directly

def render
  #{content :mybox}

otherwise the layout will be used when you access the whole page like that:

def render

That could be really confusing for anyone and it can be also hard to
decide where to declare css layouts for an element in the class, the
render or the htmlx file. :(


            |\      _,,,---,,_
      ZZZzz /,`.-'`'    -.  ;-;;,_
           |,4-  ) )-,_. ,\ (  `'-'
          '---''(_/--'  `-'\_)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070706/af7c8fb4/attachment.html 

More information about the Nitro-general mailing list