Sha256: 5b7bfad2a648d1f77aa7f7f723bb9670c414c198c40671d7b2b7616902ff165c

Contents?: true

Size: 1002 Bytes

Versions: 7

Compression:

Stored size: 1002 Bytes

Contents

require File.join(File.dirname(__FILE__), 'file_base')
module Mack
  module Rendering # :nodoc:
    module Type # :nodoc:
      # Used to render layouts around views.
      class Layout < Mack::Rendering::Type::FileBase
        
        # See Mack::Rendering::Type::FileBase render_file for more information.
        # 
        # The path to the file is built like such:
        #   app/views/layouts/#{options[:layout] || "application"}.#{format (html, xml, js, etc...)}.#{extension defined in the engine}
        # Example:
        #   app/views/layouts/application.html.erb 
        def render
          l_file = File.join(Mack.root, "app", "views", 'layouts', "#{self.options[:layout]}.#{self.options[:format]}")
          begin
            render_file(l_file, :layout)
          rescue Mack::Errors::ResourceNotFound => e
            Mack.logger.warn(e)
            self.view_template.yield_to :view
          end
        end
        
      end # Layout
    end # Type
  end # Rendering
end # Mack

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mack-0.6.0 lib/rendering/type/layout.rb
mack-0.6.0.1 lib/rendering/type/layout.rb
mack-0.6.1.2 lib/mack/rendering/type/layout.rb
mack-0.6.1.1 lib/mack/rendering/type/layout.rb
mack-0.6.1 lib/mack/rendering/type/layout.rb
mack-0.7.0 lib/mack/rendering/type/layout.rb
mack-0.7.0.1 lib/mack/rendering/type/layout.rb