mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Bring AM up to date with new rendering stack.
This commit is contained in:
parent
bdf5096816
commit
36eb1a686c
5 changed files with 21 additions and 8 deletions
|
@ -614,17 +614,15 @@ module ActionMailer #:nodoc:
|
||||||
|
|
||||||
def each_template(paths, name, &block) #:nodoc:
|
def each_template(paths, name, &block) #:nodoc:
|
||||||
Array(paths).each do |path|
|
Array(paths).each do |path|
|
||||||
self.class.view_paths.each do |load_paths|
|
templates = lookup_context.find_all(name, path)
|
||||||
templates = load_paths.find_all(name, {}, path)
|
|
||||||
templates = templates.uniq_by { |t| t.details[:formats] }
|
|
||||||
|
|
||||||
unless templates.empty?
|
unless templates.empty?
|
||||||
|
templates = templates.uniq_by { |t| t.details[:formats] }
|
||||||
templates.each(&block)
|
templates.each(&block)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def create_parts_from_responses(m, responses, charset) #:nodoc:
|
def create_parts_from_responses(m, responses, charset) #:nodoc:
|
||||||
if responses.size == 1 && !m.has_attachments?
|
if responses.size == 1 && !m.has_attachments?
|
||||||
|
|
|
@ -206,7 +206,7 @@ module ActionMailer
|
||||||
if String === @body
|
if String === @body
|
||||||
@parts.unshift create_inline_part(@body)
|
@parts.unshift create_inline_part(@body)
|
||||||
elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ }
|
elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ }
|
||||||
self.class.view_paths.first.find_all(@template, {}, @mailer_name).each do |template|
|
lookup_context.find_all(@template, @mailer_name).each do |template|
|
||||||
@parts << create_inline_part(render(:_template => template), template.mime_type)
|
@parts << create_inline_part(render(:_template => template), template.mime_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,11 @@ module ActionView
|
||||||
@view_paths.find(name, key.details, prefix, partial || false, key)
|
@view_paths.find(name, key.details, prefix, partial || false, key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_all(name, prefix = nil, partial = false)
|
||||||
|
key = details_key
|
||||||
|
@view_paths.find_all(name, key.details, prefix, partial || false, key)
|
||||||
|
end
|
||||||
|
|
||||||
def template_exists?(name, prefix = nil, partial = false)
|
def template_exists?(name, prefix = nil, partial = false)
|
||||||
key = details_key
|
key = details_key
|
||||||
@view_paths.exists?(name, key.details, prefix, partial || false, key)
|
@view_paths.exists?(name, key.details, prefix, partial || false, key)
|
||||||
|
|
|
@ -9,6 +9,14 @@ module ActionView #:nodoc:
|
||||||
METHOD
|
METHOD
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_all(path, details = {}, prefix = nil, partial = false, key=nil)
|
||||||
|
each do |resolver|
|
||||||
|
templates = resolver.find_all(path, details, prefix, partial, key)
|
||||||
|
return templates unless templates.empty?
|
||||||
|
end
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
def find(path, details = {}, prefix = nil, partial = false, key=nil)
|
def find(path, details = {}, prefix = nil, partial = false, key=nil)
|
||||||
each do |resolver|
|
each do |resolver|
|
||||||
if template = resolver.find(path, details, prefix, partial, key)
|
if template = resolver.find(path, details, prefix, partial, key)
|
||||||
|
|
|
@ -64,6 +64,8 @@ module ActionView
|
||||||
Template::Text.new(options[:text], self.formats.try(:first))
|
Template::Text.new(options[:text], self.formats.try(:first))
|
||||||
elsif options.key?(:file)
|
elsif options.key?(:file)
|
||||||
with_fallbacks { find_template(options[:file], options[:_prefix]) }
|
with_fallbacks { find_template(options[:file], options[:_prefix]) }
|
||||||
|
elsif options.key?(:_template)
|
||||||
|
options[:_template]
|
||||||
elsif options.key?(:template)
|
elsif options.key?(:template)
|
||||||
find_template(options[:template], options[:_prefix])
|
find_template(options[:template], options[:_prefix])
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue