[Nitro] Nitro and Amrita
George Moschovitis
george.moschovitis at gmail.com
Tue Apr 18 03:09:13 EDT 2006
This is extremely easy to do in Nitro with a compiler. In fact I will
implement this kind of compiler one of the following days, just for
fun (because personally I think it is useless).
Stay tuned ;-)
-g.
On 4/17/06, TRANS <transfire at gmail.com> wrote:
> On 4/16/06, George Moschovitis <george.moschovitis at gmail.com> wrote:
> > > I wouldn't neccessarily say that b/c Amrita is different from Nitro's
> > > templates. Nitro's templates are more like PHPs, while Amrita
> > > completely separates layout from data.
> >
> > NOT really. Nitro Templates can be used in PHP like mode and/or Amrita
> > style mode. Have a look at this.
> >
> >
> > def action
> > @user = User.current_user
> > @name = @user.name
> > @articles = @user.articles
> > @something =...
> > end
> >
> > action.xhtml
> >
> > <div if="@user.admin">
> > <p>#@name</p>
> > <ul for="a in @articles">
> > <li>#{a.title}</li>
> > </ul>
> > </div>
> >
> > This is fully separated layout from data.
>
> Not quite. Code elements are still being directly referenced from
> within the markup, ie. @name and @articles. In Amrita you don't even
> have that.
>
> <div id="user_admin">
> <p id="name">name here</p>
> <ul id="articles">
> <li id="title">title here</li>
> </ul>
> </div>
>
> Then in code:
>
> if @user.admin
> data = {
> :user_admin => {
> :name => @name
> :articles => @articles.collect { |a|
> { :title => a.title }
> }
> }
> }
> else
> data = { :user_admin => nil }
> end
>
> Amrita uses the data structure to determine the layout structure.
>
> T.
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>
--
http://www.gmosx.com
http://www.navel.gr
http://www.nitrohq.com
More information about the Nitro-general
mailing list