Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
148aff20
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,发现更多精彩内容 >>
提交
148aff20
编写于
12月 04, 2008
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Set template_format to html inside rjs templates so renders within it default to html.
上级
ab211bf5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
1 addition
and
23 deletion
+1
-23
actionpack/lib/action_view/base.rb
actionpack/lib/action_view/base.rb
+0
-3
actionpack/lib/action_view/template_handlers/rjs.rb
actionpack/lib/action_view/template_handlers/rjs.rb
+1
-0
actionpack/test/controller/render_test.rb
actionpack/test/controller/render_test.rb
+0
-14
actionpack/test/template/render_test.rb
actionpack/test/template/render_test.rb
+0
-6
未找到文件。
actionpack/lib/action_view/base.rb
浏览文件 @
148aff20
...
...
@@ -327,9 +327,6 @@ def _pick_template(template_path)
elsif
(
first_render
=
@_render_stack
.
first
)
&&
first_render
.
respond_to?
(
:format_and_extension
)
&&
(
template
=
self
.
view_paths
[
"
#{
template_file_name
}
.
#{
first_render
.
format_and_extension
}
"
])
template
elsif
template_format
==
:js
&&
template
=
self
.
view_paths
[
"
#{
template_file_name
}
.html"
]
@template_format
=
:html
template
else
template
=
Template
.
new
(
template_path
,
view_paths
)
...
...
actionpack/lib/action_view/template_handlers/rjs.rb
浏览文件 @
148aff20
...
...
@@ -4,6 +4,7 @@ class RJS < TemplateHandler
include
Compilable
def
compile
(
template
)
"@template_format = :html;"
+
"controller.response.content_type ||= Mime::JS;"
+
"update_page do |page|;
#{
template
.
source
}
\n
end"
end
...
...
actionpack/test/controller/render_test.rb
浏览文件 @
148aff20
...
...
@@ -246,15 +246,6 @@ def accessing_local_assigns_in_inline_template
:locals
=>
{
:local_name
=>
name
}
end
def
helper_method_to_render_to_string
(
*
args
)
render_to_string
(
*
args
)
end
helper_method
:helper_method_to_render_to_string
def
render_html_only_partial_within_inline
render
:inline
=>
"Hello world <%= helper_method_to_render_to_string :partial => 'test/partial_with_only_html_version' %>"
end
def
render_implicit_html_template
end
...
...
@@ -948,11 +939,6 @@ def test_accessing_local_assigns_in_inline_template
assert_equal
"Goodbye, Local David"
,
@response
.
body
end
def
test_rendering_html_only_partial_within_inline_with_js
get
:render_html_only_partial_within_inline
,
:format
=>
:js
assert_equal
"Hello world partial with only html version"
,
@response
.
body
end
def
test_render_in_an_rjs_template_should_pick_html_templates_when_available
[
:js
,
"js"
].
each
do
|
format
|
assert_nothing_raised
do
...
...
actionpack/test/template/render_test.rb
浏览文件 @
148aff20
...
...
@@ -136,12 +136,6 @@ def test_render_partial_and_fallback_to_layout
assert_equal
"Before (Josh)
\n\n
After"
,
@view
.
render
(
:partial
=>
"test/layout_for_partial"
,
:locals
=>
{
:name
=>
"Josh"
})
end
# TODO: The reason for this test is unclear, improve documentation
def
test_render_js_partial_and_fallback_to_erb_layout
@view
.
template_format
=
:js
assert_equal
"Before (Josh)
\n\n
After"
,
@view
.
render
(
:partial
=>
"test/layout_for_partial"
,
:locals
=>
{
:name
=>
"Josh"
})
end
# TODO: The reason for this test is unclear, improve documentation
def
test_render_missing_xml_partial_and_raise_missing_template
@view
.
template_format
=
:xml
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录