[Nitro] [PATCH] Nitro Transformer

Dimitri Aivaliotis aglarond at gmail.com
Fri Apr 28 16:28:10 EDT 2006

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

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' )

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>' )

If you're interested in the 'bluerobot.xhtml' template, I got it from
the BlueRobot
Layout Reservoir <http://www.bluerobot.com/web/layouts/>.


- Dimitri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20060428/b1913943/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nitro-transformer_multi-element.zip
Type: application/zip
Size: 18162 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20060428/b1913943/attachment.zip 

More information about the Nitro-general mailing list