[Nitro] [PATCH] Nitro Transformer

George Moschovitis george.moschovitis at gmail.com
Sat Apr 29 06:21:28 EDT 2006


Hmm.. I would prefer if we could wait a little bit on this. As I said
in another email, I think I can generalize this idea and make it more
useful and/or better integrated in nitro.

please be a bit more patient,
George.

On 4/28/06, Dimitri Aivaliotis <aglarond at gmail.com> wrote:
> On 4/25/06, Bryan Soto <bryan.a.soto at gmail.com> wrote:
> > I'll be applying this one unless there is any objection.
>
> If you could apply this latest version, that'd be great.  I've made it now
> so that multiple tags with the same name can be changed in the same
> transform (basically changed the tag storage type from Hash to Array of
> Hashes).
>
> It's also now possible to add text directly to  an Element, without having
> to get it from a file first:
>
> To hide the navigation 'div's in the 'index' method of a controller:
>
>     replace = Nitro:: Replacer.new( 'bluerobot.xhtml' )
>     replace.transform_root = 'txt'
> # this will take the text from the 'search' file in the 'txt' directory, and
> add it to the 'div' with 'class="content"'
>     replace.div ( {:class => "content"}, :search )
> # these two will add the 'class="hide"' attribute to the 'navAlpha' and
> 'navBeta' 'div's
>     replace.div( :navAlpha, :class => 'hide' )
>     replace.div ( :navBeta, :class => 'hide' )
>     replace.transform
>
>
> To add the Pager navigation to one navigation div, and a 'return to search'
> link in the other:
>
>     replace = Nitro::Replacer.new( 'bluerobot.xhtml ', '/', 'find' )
>     replace.transform_root = 'txt'
>     replace.div( {:class => "content"}, :find )
> # note that the text for the body of these Elements comes directly from the
> methods here
>     replace.div ( :navAlpha, 'Page: #{@pager.navigation}' )
>     replace.div( :navBeta, '<a href="/">search again</a>' )
>     replace.transform
>
>
> If you're interested in the 'bluerobot.xhtml' template, I got it from the
> BlueRobot Layout Reservoir.
>
> Enjoy!
>
> - Dimitri
> _______________________________________________
> 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