Re: [scalawithsails-devl] Layout templating in SwS
Status: Pre-Alpha
Brought to you by:
dpp
From: David P. <dp...@at...> - 2006-12-11 21:56:18
|
Dave, There was no code attached, but this is a really good idea. I'm currently noodling "page composition"... basically the right way to specify what components go on a page and then how they ordered into the resulting HTML (there's a CSS related issue here, but I'm punting on that for right now.) The moving parts in my mind are: - The components that exist on a page (e.g., the search box, the menu, the "main" part, etc.) - The order in which the components are laid out in the fully rendered HTML page - The "decoration" around each component (although the need for decoration is lessened with CSS) - How the component is rendered for a partial page render (e.g., AJAX or Comet update) I don't know if there should be a meta-view and/or meta-controller over-laid on the existing Rails-style controller/view paradigm. Perhaps this stuff should all just be infinitely layered so a view can be a meta-view of other views, etc. and using your paradigm, you'd have a bunch of decorators and content and the "output" of one could be piped into another. Sound reasonable? Also, I've just started an SwS developers mailing list (I've cc'ed this message to that mailing list.) Please subscribe (send an email with subject 'subscribe' to scalawithsails-devl- re...@li...) so we can continue the discussion on the list. Thanks, David On Dec 10, 2006, at 5:02 PM, Dave Webb wrote: > Hi David, > > It's been fun following what you're doing with SwS so far.. don't > understand the half of it, but I'm sure I'll learn loads trying to > keep up. > > I've attached a webapp demonstrating a simple pattern for > templating for jsps usng taglibs. > > <decorate page="mydecorator.jsp"> > <put name="my-content">content to be decorated</put> > </decorate> > > I thought this pattern might be useful as an integral part of SwS... > > e.g. for a view like > > def index = { > <html> //... banner etc > <table><tr> > <td>left content</td> > <td>right content</td> > </tr></table> > // ... > </html> > } > > .. it would be cool to have a simple mechanism to decorate the > content, you could just define: > > def index = decorate with myDecorator { > <left-content>this is left content</left-content> > <right-content>this is right content</right-content> > } > > .. and have the decorator do the rest > > .. or umm something like that.. maybe with a neater scala/DSL way > of doing things.. it's a bit like generating specific content in > xhtml fragments, then using transformers to generate the output. > > Mentioning it because for me having a simple intuitive way to > template a site, integral to SwS, would be a great time saver. > > Cheers, > Dave Webb |