Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
7c568fda
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,发现更多精彩内容 >>
提交
7c568fda
编写于
12月 26, 2010
作者:
W
wycats
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
A bunch of cleanup on the inherited template patch
上级
6c5a3bb3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
36 addition
and
21 deletion
+36
-21
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+2
-9
actionmailer/lib/action_mailer/old_api.rb
actionmailer/lib/action_mailer/old_api.rb
+1
-1
actionpack/lib/action_view/path_set.rb
actionpack/lib/action_view/path_set.rb
+25
-7
actionpack/lib/action_view/template/error.rb
actionpack/lib/action_view/template/error.rb
+6
-2
actionpack/lib/action_view/template/resolver.rb
actionpack/lib/action_view/template/resolver.rb
+1
-1
actionpack/test/controller/mime_responds_test.rb
actionpack/test/controller/mime_responds_test.rb
+1
-1
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
7c568fda
...
...
@@ -693,15 +693,8 @@ def collect_responses_and_parts_order(headers) #:nodoc:
end
def
each_template
(
paths
,
name
,
&
block
)
#:nodoc:
Array
.
wrap
(
paths
).
each
do
|
path
|
templates
=
lookup_context
.
find_all
(
name
,
path
)
templates
=
templates
.
uniq_by
{
|
t
|
t
.
formats
}
unless
templates
.
empty?
templates
.
each
(
&
block
)
return
end
end
templates
=
lookup_context
.
find_all
(
name
,
Array
.
wrap
(
paths
))
templates
.
uniq_by
{
|
t
|
t
.
formats
}.
each
(
&
block
)
end
def
create_parts_from_responses
(
m
,
responses
)
#:nodoc:
...
...
actionmailer/lib/action_mailer/old_api.rb
浏览文件 @
7c568fda
...
...
@@ -201,7 +201,7 @@ def create_parts
if
String
===
@body
@parts
.
unshift
create_inline_part
(
@body
)
elsif
@parts
.
empty?
||
@parts
.
all?
{
|
p
|
p
.
content_disposition
=~
/^attachment/
}
lookup_context
.
find_all
(
@template
,
@mailer_name
).
each
do
|
template
|
lookup_context
.
find_all
(
@template
,
[
@mailer_name
]
).
each
do
|
template
|
self
.
formats
=
template
.
formats
@parts
<<
create_inline_part
(
render
(
:template
=>
template
),
template
.
mime_type
)
end
...
...
actionpack/lib/action_view/path_set.rb
浏览文件 @
7c568fda
...
...
@@ -11,23 +11,41 @@ def #{method}(*args)
end
def
find
(
*
args
)
template
=
find_all
(
*
args
).
first
template
or
raise
MissingTemplate
.
new
(
self
,
"{
#{
args
[
1
].
join
(
','
)
}
,}/
#{
args
[
0
]
}
"
,
args
[
3
],
args
[
2
])
if
template
=
find_first
(
*
args
)
template
else
raise
MissingTemplate
.
new
(
self
,
*
args
)
end
end
def
find_all
(
path
,
prefixes
=
[],
*
args
)
templates
=
[]
prefixes
.
each
do
|
prefix
|
templates
=
[]
each
do
|
resolver
|
templates
<<
resolver
.
find_all
(
path
,
prefix
,
*
args
)
templates
.
concat
resolver
.
find_all
(
path
,
prefix
,
*
args
)
end
# return templates unless templates.flatten!.empty? XXX this was original behavior; turns this method into find_some, but probably makes it faster
return
templates
unless
templates
.
empty?
end
templates
.
flatten
[]
end
def
find_first
(
path
,
prefixes
=
[],
*
args
)
prefixes
.
each
do
|
prefix
|
each
do
|
resolver
|
if
template
=
resolver
.
find_all
(
path
,
prefix
,
*
args
).
first
return
template
end
end
end
nil
end
def
exists?
(
*
args
)
find_all
(
*
args
).
any?
!!
find_first
(
*
args
)
end
protected
...
...
actionpack/lib/action_view/template/error.rb
浏览文件 @
7c568fda
...
...
@@ -27,7 +27,7 @@ def message
class
MissingTemplate
<
ActionViewError
#:nodoc:
attr_reader
:path
def
initialize
(
paths
,
path
,
details
,
partial
)
def
initialize
(
paths
,
path
,
prefixes
,
partial
,
details
,
*
)
@path
=
path
display_paths
=
paths
.
compact
.
map
{
|
p
|
p
.
to_s
.
inspect
}.
join
(
", "
)
template_type
=
if
partial
...
...
@@ -38,7 +38,11 @@ def initialize(paths, path, details, partial)
'template'
end
super
(
"Missing
#{
template_type
}
#{
path
}
with
#{
details
.
inspect
}
in view paths
#{
display_paths
}
"
)
searched_paths
=
prefixes
.
map
{
|
prefix
|
[
prefix
,
path
].
join
(
"/"
)
}
out
=
"Missing
#{
template_type
}
#{
searched_paths
.
join
(
", "
)
}
with
#{
details
.
inspect
}
. Searched in:
\n
"
out
+=
paths
.
compact
.
map
{
|
p
|
" *
#{
p
.
to_s
.
inspect
}
\n
"
}.
join
super
out
end
end
...
...
actionpack/lib/action_view/template/resolver.rb
浏览文件 @
7c568fda
...
...
@@ -47,7 +47,7 @@ def build_path(name, prefix, partial)
path
end
# H
na
dles templates caching. If a key is given and caching is on
# H
an
dles templates caching. If a key is given and caching is on
# always check the cache before hitting the resolver. Otherwise,
# it always hits the resolver but check if the resolver is fresher
# before returning it.
...
...
actionpack/test/controller/mime_responds_test.rb
浏览文件 @
7c568fda
...
...
@@ -565,7 +565,7 @@ def using_resource_with_responder
def
using_resource_with_action
respond_with
(
resource
,
:action
=>
:foo
)
do
|
format
|
format
.
html
{
raise
ActionView
::
MissingTemplate
.
new
([],
"
foo/bar"
,
{},
false
)
}
format
.
html
{
raise
ActionView
::
MissingTemplate
.
new
([],
"
bar"
,
[
"foo"
]
,
{},
false
)
}
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录