Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
8d7ce0f2
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,发现更多精彩内容 >>
提交
8d7ce0f2
编写于
5月 09, 2014
作者:
N
Nick Sutterer
提交者:
Rafael Mendonça França
8月 24, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove LookupContext#with_layout_format by passing formats for layouts explicitely.
上级
be19bf37
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
11 addition
and
24 deletion
+11
-24
actionview/lib/action_view/lookup_context.rb
actionview/lib/action_view/lookup_context.rb
+0
-16
actionview/lib/action_view/renderer/streaming_template_renderer.rb
...w/lib/action_view/renderer/streaming_template_renderer.rb
+1
-1
actionview/lib/action_view/renderer/template_renderer.rb
actionview/lib/action_view/renderer/template_renderer.rb
+10
-7
未找到文件。
actionview/lib/action_view/lookup_context.rb
浏览文件 @
8d7ce0f2
...
...
@@ -229,21 +229,5 @@ def locale=(value)
super
(
default_locale
)
end
# Uses the first format in the formats array for layout lookup.
def
with_layout_format
if
formats
.
size
==
1
yield
else
old_formats
=
formats
_set_detail
(
:formats
,
formats
[
0
,
1
])
begin
yield
ensure
_set_detail
(
:formats
,
old_formats
)
end
end
end
end
end
actionview/lib/action_view/renderer/streaming_template_renderer.rb
浏览文件 @
8d7ce0f2
...
...
@@ -47,7 +47,7 @@ def render_template(template, layout_name = nil, locals = {}) #:nodoc:
return
[
super
]
unless
layout_name
&&
template
.
supports_streaming?
locals
||=
{}
layout
=
layout_name
&&
find_layout
(
layout_name
,
locals
.
keys
)
layout
=
layout_name
&&
find_layout
(
layout_name
,
locals
.
keys
,
[
formats
.
first
]
)
Body
.
new
do
|
buffer
|
delayed_render
(
buffer
,
template
,
layout
,
@view
,
locals
)
...
...
actionview/lib/action_view/renderer/template_renderer.rb
浏览文件 @
8d7ce0f2
...
...
@@ -57,7 +57,7 @@ def render_template(template, layout_name = nil, locals = nil) #:nodoc:
end
def
render_with_layout
(
path
,
locals
)
#:nodoc:
layout
=
path
&&
find_layout
(
path
,
locals
.
keys
)
layout
=
path
&&
find_layout
(
path
,
locals
.
keys
,
[
formats
.
first
]
)
content
=
yield
(
layout
)
if
layout
...
...
@@ -72,25 +72,28 @@ def render_with_layout(path, locals) #:nodoc:
# This is the method which actually finds the layout using details in the lookup
# context object. If no layout is found, it checks if at least a layout with
# the given name exists across all details before raising the error.
def
find_layout
(
layout
,
keys
)
with_layout_format
{
resolve_layout
(
layout
,
keys
)
}
def
find_layout
(
layout
,
keys
,
formats
)
resolve_layout
(
layout
,
keys
,
formats
)
end
def
resolve_layout
(
layout
,
keys
)
def
resolve_layout
(
layout
,
keys
,
formats
)
details
=
@details
.
dup
details
[
:formats
]
=
formats
case
layout
when
String
begin
if
layout
=~
/^\//
with_fallbacks
{
find_template
(
layout
,
nil
,
false
,
keys
,
@
details
)
}
with_fallbacks
{
find_template
(
layout
,
nil
,
false
,
keys
,
details
)
}
else
find_template
(
layout
,
nil
,
false
,
keys
,
@
details
)
find_template
(
layout
,
nil
,
false
,
keys
,
details
)
end
rescue
ActionView
::
MissingTemplate
all_details
=
@details
.
merge
(
:formats
=>
@lookup_context
.
default_formats
)
raise
unless
template_exists?
(
layout
,
nil
,
false
,
keys
,
all_details
)
end
when
Proc
resolve_layout
(
layout
.
call
,
keys
)
resolve_layout
(
layout
.
call
,
keys
,
formats
)
when
FalseClass
nil
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录