This is a nice little trick to defer some block execution in a multi-pane layout module Views def layout html do #... body do div.main { yield } div.right! &@_right_pane if @_right_pane end end end def _right_pane(&block) @_right_pane = block end # So now on your view def some_view # use that method if you need the right pane _right_pane do # Some code in the right pane end # And here goes your regular view end end Cheers, zimbatm
That''s pretty damned cool. Good technique! --beppu On Thu, Aug 28, 2008 at 3:46 AM, zimbatm <zimbatm at oree.ch> wrote:> This is a nice little trick to defer some block execution in a multi-pane > layout > > module Views > def layout > html do > #... > body do > div.main { yield } > div.right! &@_right_pane if @_right_pane > end > end > end > > def _right_pane(&block) > @_right_pane = block > end > > # So now on your view > def some_view > # use that method if you need the right pane > _right_pane do > # Some code in the right pane > end > > # And here goes your regular view > end > end > > Cheers, > zimbatm > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20080828/34de6e91/attachment.html>
That''s an awesome tip for Markaby. I''ll remember that! On Thu, Aug 28, 2008 at 7:57 AM, John Beppu <john.beppu at gmail.com> wrote:> That''s pretty damned cool. Good technique! > > --beppu > > On Thu, Aug 28, 2008 at 3:46 AM, zimbatm <zimbatm at oree.ch> wrote: >> >> This is a nice little trick to defer some block execution in a multi-pane >> layout >> >> module Views >> def layout >> html do >> #... >> body do >> div.main { yield } >> div.right! &@_right_pane if @_right_pane >> end >> end >> end >> >> def _right_pane(&block) >> @_right_pane = block >> end >> >> # So now on your view >> def some_view >> # use that method if you need the right pane >> _right_pane do >> # Some code in the right pane >> end >> >> # And here goes your regular view >> end >> end >> >> Cheers, >> zimbatm >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >