2009-07-19 09:12:15 -04:00
|
|
|
module ActionView
|
|
|
|
module CompiledTemplates #:nodoc:
|
|
|
|
# holds compiled template code
|
|
|
|
end
|
2011-04-18 02:52:29 -04:00
|
|
|
|
2010-06-16 14:17:49 -04:00
|
|
|
# = Action View Context
|
|
|
|
#
|
|
|
|
# Action View contexts are supplied to Action Controller to render template.
|
|
|
|
# The default Action View context is ActionView::Base.
|
2009-07-19 09:12:15 -04:00
|
|
|
#
|
2011-05-01 06:16:31 -04:00
|
|
|
# In order to work with ActionController, a Context must just include this module.
|
2011-05-01 06:56:04 -04:00
|
|
|
# The initialization of the variables used by the context (@output_buffer, @view_flow,
|
2011-05-01 13:39:57 -04:00
|
|
|
# and @virtual_path) is responsibility of the object that includes this module
|
|
|
|
# (although you can call _prepare_context defined below).
|
2009-07-19 09:12:15 -04:00
|
|
|
module Context
|
|
|
|
include CompiledTemplates
|
2011-05-01 06:16:31 -04:00
|
|
|
attr_accessor :output_buffer, :view_flow
|
|
|
|
|
2011-05-01 13:39:57 -04:00
|
|
|
# Prepares the context by setting the appropriate instance variables.
|
|
|
|
# :api: plugin
|
|
|
|
def _prepare_context
|
|
|
|
@view_flow = OutputFlow.new
|
|
|
|
@output_buffer = nil
|
|
|
|
@virtual_path = nil
|
|
|
|
end
|
2011-05-01 06:16:31 -04:00
|
|
|
|
2011-05-01 13:39:57 -04:00
|
|
|
# Encapsulates the interaction with the view flow so it
|
|
|
|
# returns the correct buffer on yield. This is usually
|
|
|
|
# overwriten by helpers to add more behavior.
|
|
|
|
# :api: plugin
|
|
|
|
def _layout_for(name=nil)
|
|
|
|
name ||= :layout
|
|
|
|
view_flow.get(name).html_safe
|
2011-05-01 06:16:31 -04:00
|
|
|
end
|
2009-07-19 09:12:15 -04:00
|
|
|
end
|
|
|
|
end
|