Sha256: 5ed9a4dfb581c43a1307f1c520f9492460299d8ed749f697d875a27a9267911a

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

module Waves
  
  module Helpers

    module Layouts

      # Invokes a layout view (i.e., a view from the layouts template directory), using
      # the assigns parameter to define instance variables for the view. The block is
      # evaluated and also passed into the view as the +layout_content+ instance variable.
      #
      # You can define a layout just by creating a template and then calling the
      # +layout_content+ accessor when you want to embed the caller's content.
      #
      # == Example
      #
      #   doctype :html4_transitional
      #   html do
      #     title @title # passed as an assigns parameter
      #   end
      #   body do
      #     layout_content
      #   end
      #
      def layout( name, assigns = {}, &block )
        assigns[ :layout_content ] = capture(&block)
        self << Waves.main::Views[:layouts].process( request ) do
          send( name, assigns )
        end
      end
      
      def layout_content
        self << @layout_content
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
dyoder-waves-0.8.0 lib/helpers/layouts.rb
waves-edge-2009.03.10.13.14 lib/helpers/layouts.rb
waves-stable-2009.3.10 lib/helpers/layouts.rb
waves-0.8.0 lib/helpers/layouts.rb
waves-0.8.1 lib/helpers/layouts.rb
waves-0.8.2 lib/helpers/layouts.rb