Sha256: 2259c30e3eed3bcd724f292b0b6430a11190d4a8873b05fa049b3e15b99b096b

Contents?: true

Size: 1019 Bytes

Versions: 2

Compression:

Stored size: 1019 Bytes

Contents

require File.join(File.dirname(__FILE__), 'file_base')
module Mack
  module Rendering # :nodoc:
    module Type # :nodoc:
      # Pretty much the same thing as Mack::Rendering::Type::Action, except the template is relative to the app/views directory,
      # and not the app/views/#{controller name} directory like action.
      class Template < 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/#{template (show, index, etc...)}.#{format (html, xml, js, etc...)}.#{extension defined in the engine}
        # Example:
        #   <%= render(:template, "users/show") %> # => app/views/users/show.html.erb
        def render
          t_file = File.join(Mack::Configuration.views_directory, "#{self.render_value}.#{self.options[:format]}")
          render_file(t_file, :template)
        end
        
      end # Template
    end # Type
  end # Rendering
end # Mack

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mack-0.5.5.3 lib/rendering/type/template.rb
mack-0.5.5.4 lib/rendering/type/template.rb