Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
0612fd0f
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0612fd0f
编写于
8月 07, 2009
作者:
Y
Yehuda Katz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace _render_template_with_layout with _render_template since the layout is optional
上级
b3e199f6
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
29 addition
and
21 deletion
+29
-21
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+2
-2
actionmailer/test/mail_service_test.rb
actionmailer/test/mail_service_test.rb
+6
-4
actionpack/lib/action_view/render/partials.rb
actionpack/lib/action_view/render/partials.rb
+2
-2
actionpack/lib/action_view/render/rendering.rb
actionpack/lib/action_view/render/rendering.rb
+13
-9
actionpack/lib/action_view/test_case.rb
actionpack/lib/action_view/test_case.rb
+2
-2
actionpack/test/controller/logging_test.rb
actionpack/test/controller/logging_test.rb
+2
-1
actionpack/test/controller/render_test.rb
actionpack/test/controller/render_test.rb
+2
-1
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
0612fd0f
...
...
@@ -566,7 +566,7 @@ def render_template(template, body)
@template
=
initialize_template_class
(
body
)
layout
=
_pick_layout
(
layout
,
true
)
unless
ActionController
::
Base
.
exempt_from_layout
.
include?
(
template
.
handler
)
@template
.
_render_template
_with_layout
(
template
,
layout
,
{})
@template
.
_render_template
(
template
,
layout
,
{})
ensure
@current_template_content_type
=
nil
end
...
...
@@ -592,7 +592,7 @@ def render(opts)
!
template
||
ActionController
::
Base
.
exempt_from_layout
.
include?
(
template
.
handler
))
if
template
@template
.
_render_template
_with_layout
(
template
,
layout
,
opts
)
@template
.
_render_template
(
template
,
layout
,
opts
)
elsif
inline
=
opts
[
:inline
]
@template
.
_render_inline
(
inline
,
layout
,
opts
)
end
...
...
actionmailer/test/mail_service_test.rb
浏览文件 @
0612fd0f
...
...
@@ -573,12 +573,14 @@ def initialize
@info_contents
,
@debug_contents
=
""
,
""
end
def
info
(
str
)
@info_contents
<<
str
def
info
(
str
=
nil
,
&
blk
)
@info_contents
<<
str
if
str
@info_contents
<<
blk
.
call
if
block_given?
end
def
debug
(
str
)
@debug_contents
<<
str
def
debug
(
str
=
nil
,
&
blk
)
@debug_contents
<<
str
if
str
@debug_contents
<<
blk
.
call
if
block_given?
end
end
...
...
actionpack/lib/action_view/render/partials.rb
浏览文件 @
0612fd0f
...
...
@@ -248,7 +248,7 @@ def _render_partial_object(template, options)
options
[
:_template
]
=
template
_render_template
(
template
,
locals
)
_render_
single_
template
(
template
,
locals
)
end
end
...
...
@@ -275,7 +275,7 @@ def _render_partial_collection(collection, options = {}, passed_template = nil)
index
+=
1
_render_template
(
template
,
locals
)
_render_
single_
template
(
template
,
locals
)
end
.
join
(
spacer
)
end
...
...
actionpack/lib/action_view/render/rendering.rb
浏览文件 @
0612fd0f
...
...
@@ -27,7 +27,7 @@ def render(options = {}, local_assigns = {}, &block) #:nodoc:
if
file
=
options
[
:file
]
template
=
find_by_parts
(
file
,
{
:formats
=>
formats
})
_render_template
_with_layout
(
template
,
layout
,
:locals
=>
options
[
:locals
])
_render_template
(
template
,
layout
,
:locals
=>
options
[
:locals
])
elsif
inline
=
options
[
:inline
]
_render_inline
(
inline
,
layout
,
options
)
elsif
text
=
options
[
:text
]
...
...
@@ -54,7 +54,7 @@ def _render_content(content, layout, locals)
old_content
,
@_content_for
[
:layout
]
=
@_content_for
[
:layout
],
content
@cached_content_for_layout
=
@_content_for
[
:layout
]
_render_template
(
layout
,
locals
)
_render_
single_
template
(
layout
,
locals
)
ensure
@_content_for
[
:layout
]
=
old_content
end
...
...
@@ -97,9 +97,9 @@ def layout_proc(name)
!
@_content_for
.
key?
(
name
)
&&
@_proc_for_layout
||
@_default_layout
end
def
_render_
template
(
template
,
local_assign
s
=
{})
def
_render_
single_template
(
template
,
local
s
=
{})
with_template
(
template
)
do
template
.
render
(
self
,
local
_assign
s
)
do
|*
names
|
template
.
render
(
self
,
locals
)
do
|*
names
|
capture
(
*
names
,
&
layout_proc
(
names
.
first
))
end
end
...
...
@@ -115,7 +115,7 @@ def _render_template(template, local_assigns = {})
def
_render_inline
(
inline
,
layout
,
options
)
handler
=
Template
.
handler_class_for_extension
(
options
[
:type
]
||
"erb"
)
template
=
Template
.
new
(
options
[
:inline
],
"inline
#{
options
[
:inline
].
inspect
}
"
,
handler
,
{})
content
=
_render_template
(
template
,
options
[
:locals
]
||
{})
content
=
_render_
single_
template
(
template
,
options
[
:locals
]
||
{})
layout
?
_render_content
(
content
,
layout
,
options
[
:locals
])
:
content
end
...
...
@@ -132,18 +132,22 @@ def _render_text(text, layout, options)
def
render_template
(
options
)
@assigns_added
=
nil
template
,
layout
,
partial
=
options
.
values_at
(
:_template
,
:_layout
,
:_partial
)
_render_template
_with_layout
(
template
,
layout
,
options
,
partial
)
_render_template
(
template
,
layout
,
options
,
partial
)
end
def
_render_template_with_layout
(
template
,
layout
=
nil
,
options
=
{},
partial
=
nil
)
logger
&&
logger
.
info
(
"Rendering
#{
template
.
identifier
}#{
' (#{options[:status]})'
if
options
[
:status
]
}
"
)
def
_render_template
(
template
,
layout
=
nil
,
options
=
{},
partial
=
nil
)
logger
&&
logger
.
info
do
msg
=
"Rendering
#{
template
.
identifier
}
"
msg
<<
" (
#{
options
[
:status
]
}
)"
if
options
[
:status
]
msg
end
locals
=
options
[
:locals
]
||
{}
content
=
if
partial
_render_partial_object
(
template
,
options
)
else
_render_template
(
template
,
locals
)
_render_
single_
template
(
template
,
locals
)
end
_render_content
(
content
,
layout
,
locals
)
...
...
actionpack/lib/action_view/test_case.rb
浏览文件 @
0612fd0f
...
...
@@ -9,8 +9,8 @@ def initialize(*args)
end
attr_internal
:rendered
alias_method
:_render_template_without_template_tracking
,
:_render_template
def
_render_template
(
template
,
local_assigns
=
{})
alias_method
:_render_template_without_template_tracking
,
:_render_
single_
template
def
_render_
single_
template
(
template
,
local_assigns
=
{})
if
template
.
respond_to?
(
:identifier
)
&&
template
.
present?
@_rendered
[
:partials
][
template
]
+=
1
if
template
.
partial?
@_rendered
[
:template
]
||=
[]
...
...
actionpack/test/controller/logging_test.rb
浏览文件 @
0612fd0f
...
...
@@ -17,9 +17,10 @@ def initialize
@level
=
Logger
::
DEBUG
end
def
method_missing
(
method
,
*
args
)
def
method_missing
(
method
,
*
args
,
&
blk
)
@logged
||=
[]
@logged
<<
args
.
first
@logged
<<
blk
.
call
if
block_given?
end
end
...
...
actionpack/test/controller/render_test.rb
浏览文件 @
0612fd0f
...
...
@@ -17,8 +17,9 @@ def initialize
@logged
=
[]
end
def
method_missing
(
method
,
*
args
)
def
method_missing
(
method
,
*
args
,
&
blk
)
@logged
<<
args
.
first
@logged
<<
blk
.
call
if
block_given?
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录