mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Replace _action_view with view_context to reflect that it is public and that it does not need to be an ActionView instance
This commit is contained in:
parent
f0945409d9
commit
af375a5eb3
6 changed files with 10 additions and 11 deletions
|
@ -13,7 +13,7 @@ class Kaigi < ActionController::Http
|
||||||
before_filter :set_name
|
before_filter :set_name
|
||||||
append_view_path "views"
|
append_view_path "views"
|
||||||
|
|
||||||
def _action_view
|
def view_context
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ module AbstractController
|
||||||
# partial<Boolean>:: Whether or not the template to render is a partial
|
# partial<Boolean>:: Whether or not the template to render is a partial
|
||||||
#
|
#
|
||||||
# Override this method in a to change the default behavior.
|
# Override this method in a to change the default behavior.
|
||||||
def _action_view
|
def view_context
|
||||||
@_action_view ||= ActionView::Base.for_controller(self)
|
@_view_context ||= ActionView::Base.for_controller(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Mostly abstracts the fact that calling render twice is a DoubleRenderError.
|
# Mostly abstracts the fact that calling render twice is a DoubleRenderError.
|
||||||
|
@ -55,7 +55,7 @@ module AbstractController
|
||||||
def render_to_body(options = {})
|
def render_to_body(options = {})
|
||||||
# TODO: Refactor so we can just use the normal template logic for this
|
# TODO: Refactor so we can just use the normal template logic for this
|
||||||
if options[:_partial_object]
|
if options[:_partial_object]
|
||||||
_action_view.render_partial(options)
|
view_context.render_partial(options)
|
||||||
else
|
else
|
||||||
_determine_template(options)
|
_determine_template(options)
|
||||||
_render_template(options)
|
_render_template(options)
|
||||||
|
@ -77,7 +77,7 @@ module AbstractController
|
||||||
# _layout<ActionView::Template>:: The layout to wrap the template in (optional)
|
# _layout<ActionView::Template>:: The layout to wrap the template in (optional)
|
||||||
# _partial<TrueClass, FalseClass>:: Whether or not the template to be rendered is a partial
|
# _partial<TrueClass, FalseClass>:: Whether or not the template to be rendered is a partial
|
||||||
def _render_template(options)
|
def _render_template(options)
|
||||||
_action_view.render_template(options[:_template], options[:_layout], options, options[:_partial])
|
view_context.render_template(options[:_template], options[:_layout], options, options[:_partial])
|
||||||
end
|
end
|
||||||
|
|
||||||
# The list of view paths for this controller. See ActionView::ViewPathSet for
|
# The list of view paths for this controller. See ActionView::ViewPathSet for
|
||||||
|
|
|
@ -72,7 +72,7 @@ module ActionController
|
||||||
|
|
||||||
# TODO: Remove this after we flip
|
# TODO: Remove this after we flip
|
||||||
def template
|
def template
|
||||||
@template ||= _action_view
|
@template ||= view_context
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_action(*)
|
def process_action(*)
|
||||||
|
@ -141,7 +141,7 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
def view_paths
|
def view_paths
|
||||||
_action_view.view_paths
|
view_context.view_paths
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,7 +85,7 @@ module ActionController
|
||||||
register_renderer :update
|
register_renderer :update
|
||||||
|
|
||||||
def _render_update(proc, options)
|
def _render_update(proc, options)
|
||||||
generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(_action_view, &proc)
|
generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(view_context, &proc)
|
||||||
self.content_type = Mime::JS
|
self.content_type = Mime::JS
|
||||||
self.response_body = generator.to_s
|
self.response_body = generator.to_s
|
||||||
end
|
end
|
||||||
|
|
|
@ -129,8 +129,7 @@ module ActionController #:nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
def content_for_layout(controller)
|
def content_for_layout(controller)
|
||||||
# TODO: Remove this when new base is merged in
|
template = controller.view_context
|
||||||
template = controller.respond_to?(:template) ? controller.template : controller._action_view
|
|
||||||
template.layout && template.instance_variable_get('@cached_content_for_layout')
|
template.layout && template.instance_variable_get('@cached_content_for_layout')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -78,7 +78,7 @@ module ActionController
|
||||||
def assert_template(options = {}, message = nil)
|
def assert_template(options = {}, message = nil)
|
||||||
validate_request!
|
validate_request!
|
||||||
|
|
||||||
hax = @controller._action_view.instance_variable_get(:@_rendered)
|
hax = @controller.view_context.instance_variable_get(:@_rendered)
|
||||||
|
|
||||||
case options
|
case options
|
||||||
when NilClass, String
|
when NilClass, String
|
||||||
|
|
Loading…
Reference in a new issue