Expose a _render_partial hook as thhe _render_template one and make use of it.
This commit is contained in:
parent
33c98b15bc
commit
c03c40b481
|
@ -254,6 +254,7 @@ module ActionMailer #:nodoc:
|
||||||
include Quoting
|
include Quoting
|
||||||
extend AdvAttrAccessor
|
extend AdvAttrAccessor
|
||||||
|
|
||||||
|
include AbstractController::Logger
|
||||||
include AbstractController::Rendering
|
include AbstractController::Rendering
|
||||||
include AbstractController::LocalizedCache
|
include AbstractController::LocalizedCache
|
||||||
include AbstractController::Layouts
|
include AbstractController::Layouts
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
require "abstract_controller/base"
|
require "abstract_controller/base"
|
||||||
require "abstract_controller/logger"
|
|
||||||
|
|
||||||
module AbstractController
|
module AbstractController
|
||||||
class DoubleRenderError < Error
|
class DoubleRenderError < Error
|
||||||
|
@ -13,8 +12,6 @@ module AbstractController
|
||||||
module Rendering
|
module Rendering
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
include AbstractController::Logger
|
|
||||||
|
|
||||||
included do
|
included do
|
||||||
extlib_inheritable_accessor :_view_paths
|
extlib_inheritable_accessor :_view_paths
|
||||||
self._view_paths ||= ActionView::PathSet.new
|
self._view_paths ||= ActionView::PathSet.new
|
||||||
|
@ -67,7 +64,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.key?(:partial)
|
if options.key?(:partial)
|
||||||
view_context.render_partial(options)
|
_render_partial(options)
|
||||||
else
|
else
|
||||||
_determine_template(options)
|
_determine_template(options)
|
||||||
_render_template(options)
|
_render_template(options)
|
||||||
|
@ -87,11 +84,18 @@ module AbstractController
|
||||||
# ==== Options
|
# ==== Options
|
||||||
# _template<ActionView::Template>:: The template to render
|
# _template<ActionView::Template>:: The template to render
|
||||||
# _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
|
|
||||||
def _render_template(options)
|
def _render_template(options)
|
||||||
view_context.render_template(options)
|
view_context.render_template(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Renders the given partial.
|
||||||
|
#
|
||||||
|
# ==== Options
|
||||||
|
# partial<String|Object>:: The partial name or the object to be rendered
|
||||||
|
def _render_partial(options)
|
||||||
|
view_context.render_partial(options)
|
||||||
|
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
|
||||||
# more details about writing custom view paths.
|
# more details about writing custom view paths.
|
||||||
def view_paths
|
def view_paths
|
||||||
|
|
|
@ -20,12 +20,6 @@ module ActionController
|
||||||
|
|
||||||
def render_to_body(options)
|
def render_to_body(options)
|
||||||
_process_options(options)
|
_process_options(options)
|
||||||
|
|
||||||
if options.key?(:partial)
|
|
||||||
options[:partial] = action_name if options[:partial] == true
|
|
||||||
options[:_details] = {:formats => formats}
|
|
||||||
end
|
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,6 +37,12 @@ module ActionController
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def _render_partial(options)
|
||||||
|
options[:partial] = action_name if options[:partial] == true
|
||||||
|
options[:_details] = {:formats => formats}
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def format_for_text
|
def format_for_text
|
||||||
formats.first
|
formats.first
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue