Node.js/Express Partials problem: Can't be nested too deep?
- by heorling
I'm learning Node.js, Express, haml.js and liking it. I've run into a prety annoying problem though. I'm pretty new to this but have been getting nice results so far.
I'm writing a jquery heavy web app that relies on a table containing divs. The divs slide around, switch back and fourth and are resized etc to my hearts content.
What I'm looking for a way to switch (template?) the divs. Since I've been building in express and mimicking the chat example it would make sense to use partials. The rub is that I've been using inexplicit divs in haml, held within a td. The divs are cunstructed as follows:
%tr
%td
.class1.class2.class3.classetc
Which has worked fine cross browser. Parsing the classes works great for the js code to pass arguments around, fetch values etc.
What I'd like to be able to do is something like:
%tr
%td
.class1.class2.class3.classetc
%ul#messages
!= this.partial('message.html.haml', { collection: messages })
Any combination I've tried with this has failed however. And I might have tried them all.
If I could put a partial into that div I'd probably be set. And you can nest them as long as you use #ids instead of .classes. But if you use more than one class it breaks! I think that's the most accurate way of summing it up.
How do you do this? I've checked out various templating solutions like mu.js and micro template like by John Resig. I earlier checked out this thread on templating engines. It's very possible I'm making some fundamental mistake here, I'm new to this.
What's a good way to do this?