Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
010a0c92
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 搜索 >>
提交
010a0c92
编写于
8月 07, 2009
作者:
Y
Yehuda Katz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename find_by_parts and find_by_parts? to find and exists?
上级
55575e21
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
20 addition
and
20 deletion
+20
-20
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+2
-2
actionpack/lib/abstract_controller/layouts.rb
actionpack/lib/abstract_controller/layouts.rb
+2
-2
actionpack/lib/abstract_controller/rendering_controller.rb
actionpack/lib/abstract_controller/rendering_controller.rb
+1
-1
actionpack/lib/action_controller/base.rb
actionpack/lib/action_controller/base.rb
+1
-1
actionpack/lib/action_controller/legacy/layout.rb
actionpack/lib/action_controller/legacy/layout.rb
+1
-1
actionpack/lib/action_view/base.rb
actionpack/lib/action_view/base.rb
+1
-1
actionpack/lib/action_view/paths.rb
actionpack/lib/action_view/paths.rb
+5
-5
actionpack/lib/action_view/render/partials.rb
actionpack/lib/action_view/render/partials.rb
+1
-1
actionpack/lib/action_view/render/rendering.rb
actionpack/lib/action_view/render/rendering.rb
+2
-2
actionpack/lib/action_view/template/resolver.rb
actionpack/lib/action_view/template/resolver.rb
+1
-1
actionpack/test/abstract_controller/abstract_controller_test.rb
...pack/test/abstract_controller/abstract_controller_test.rb
+2
-2
actionpack/test/abstract_controller/helper_test.rb
actionpack/test/abstract_controller/helper_test.rb
+1
-1
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
010a0c92
...
...
@@ -499,7 +499,7 @@ def create!(method_name, *parameters) #:nodoc:
# ====
# TODO: Revisit this
# template_exists = @parts.empty?
# template_exists ||= template_root.find
_by_parts
("#{mailer_name}/#{@template}")
# template_exists ||= template_root.find("#{mailer_name}/#{@template}")
# @body = render_message(@template, @body) if template_exists
# Finally, if there are other message parts and a textual body exists,
...
...
@@ -585,7 +585,7 @@ def render(opts)
if
file
prefix
=
mailer_name
unless
file
=~
/\//
template
=
view_paths
.
find
_by_parts
(
file
,
{
:formats
=>
formats
},
prefix
)
template
=
view_paths
.
find
(
file
,
{
:formats
=>
formats
},
prefix
)
end
layout
=
_pick_layout
(
layout
,
...
...
actionpack/lib/abstract_controller/layouts.rb
浏览文件 @
010a0c92
...
...
@@ -76,7 +76,7 @@ def _layout(details)
when
nil
self
.
class_eval
<<-
ruby_eval
,
__FILE__
,
__LINE__
+
1
def _layout(details)
if view_paths.
find_by_par
ts?("
#{
_implied_layout_name
}
", details, "layouts")
if view_paths.
exis
ts?("
#{
_implied_layout_name
}
", details, "layouts")
"
#{
_implied_layout_name
}
"
else
super
...
...
@@ -131,7 +131,7 @@ def _layout_for_name(name, details = {:formats => formats})
def
_find_layout
(
name
,
details
)
# TODO: Make prefix actually part of details in ViewPath#find_by_parts
prefix
=
details
.
key?
(
:prefix
)
?
details
.
delete
(
:prefix
)
:
"layouts"
view_paths
.
find
_by_parts
(
name
,
details
,
prefix
)
view_paths
.
find
(
name
,
details
,
prefix
)
end
# Returns the default layout for this controller and a given set of details.
...
...
actionpack/lib/abstract_controller/rendering_controller.rb
浏览文件 @
010a0c92
...
...
@@ -111,7 +111,7 @@ def self.body_to_s(body)
def
_determine_template
(
options
)
name
=
(
options
[
:_template_name
]
||
action_name
).
to_s
options
[
:_template
]
||=
view_paths
.
find
_by_parts
(
options
[
:_template
]
||=
view_paths
.
find
(
name
,
{
:formats
=>
formats
},
options
[
:_prefix
],
options
[
:_partial
]
)
end
...
...
actionpack/lib/action_controller/base.rb
浏览文件 @
010a0c92
...
...
@@ -51,7 +51,7 @@ def default_render
def
method_for_action
(
action_name
)
super
||
begin
if
view_paths
.
find_by_par
ts?
(
action_name
.
to_s
,
{
:formats
=>
formats
,
:locales
=>
[
I18n
.
locale
]},
controller_path
)
if
view_paths
.
exis
ts?
(
action_name
.
to_s
,
{
:formats
=>
formats
,
:locales
=>
[
I18n
.
locale
]},
controller_path
)
"default_render"
end
end
...
...
actionpack/lib/action_controller/legacy/layout.rb
浏览文件 @
010a0c92
...
...
@@ -191,7 +191,7 @@ def default_layout(*args)
def
memoized_find_layout
(
layout
,
formats
)
#:nodoc:
return
layout
if
layout
.
nil?
||
layout
.
respond_to?
(
:render
)
prefix
=
layout
.
to_s
=~
/layouts\//
?
nil
:
"layouts"
view_paths
.
find
_by_parts
(
layout
.
to_s
,
{
:formats
=>
formats
},
prefix
)
view_paths
.
find
(
layout
.
to_s
,
{
:formats
=>
formats
},
prefix
)
end
def
find_layout
(
*
args
)
...
...
actionpack/lib/action_view/base.rb
浏览文件 @
010a0c92
...
...
@@ -202,7 +202,7 @@ def self.cache_template_loading?
delegate
:logger
,
:to
=>
:controller
,
:allow_nil
=>
true
delegate
:find
_by_parts
,
:to
=>
:view_paths
delegate
:find
,
:to
=>
:view_paths
include
Context
...
...
actionpack/lib/action_view/paths.rb
浏览文件 @
010a0c92
...
...
@@ -33,12 +33,12 @@ def unshift(*objs)
super
(
*
objs
.
map
{
|
obj
|
self
.
class
.
type_cast
(
obj
)
})
end
def
find
_by_parts
(
path
,
details
=
{},
prefix
=
nil
,
partial
=
false
)
def
find
(
path
,
details
=
{},
prefix
=
nil
,
partial
=
false
)
# template_path = path.sub(/^\//, '')
template_path
=
path
each
do
|
load_path
|
if
template
=
load_path
.
find
_by_parts
(
template_path
,
details
,
prefix
,
partial
)
if
template
=
load_path
.
find
(
template_path
,
details
,
prefix
,
partial
)
return
template
end
end
...
...
@@ -48,11 +48,11 @@ def find_by_parts(path, details = {}, prefix = nil, partial = false)
raise
ActionView
::
MissingTemplate
.
new
(
self
,
"
#{
prefix
}
/
#{
path
}
-
#{
details
.
inspect
}
- partial:
#{
!!
partial
}
"
)
end
def
find_by_par
ts?
(
path
,
extension
=
nil
,
prefix
=
nil
,
partial
=
false
)
def
exis
ts?
(
path
,
extension
=
nil
,
prefix
=
nil
,
partial
=
false
)
template_path
=
path
.
sub
(
/^\//
,
''
)
each
do
|
load_path
|
return
true
if
template
=
load_path
.
find
_by_parts
(
template_path
,
extension
,
prefix
,
partial
)
return
true
if
template
=
load_path
.
find
(
template_path
,
extension
,
prefix
,
partial
)
end
false
end
...
...
@@ -62,7 +62,7 @@ def find_template(original_template_path, format = nil, html_fallback = true)
template_path
=
original_template_path
.
sub
(
/^\//
,
''
)
each
do
|
load_path
|
if
template
=
load_path
.
find
_by_parts
(
template_path
,
format
)
if
template
=
load_path
.
find
(
template_path
,
format
)
return
template
# Try to find html version if the format is javascript
elsif
format
==
:js
&&
html_fallback
&&
template
=
load_path
[
"
#{
template_path
}
.
#{
I18n
.
locale
}
.html"
]
...
...
actionpack/lib/action_view/render/partials.rb
浏览文件 @
010a0c92
...
...
@@ -258,7 +258,7 @@ def _render_partial_collection(collection, options = {}, template = nil, &block)
def
_pick_partial_template
(
partial_path
)
#:nodoc:
prefix
=
controller_path
unless
partial_path
.
include?
(
?/
)
find
_by_parts
(
partial_path
,
{
:formats
=>
formats
},
prefix
,
true
)
find
(
partial_path
,
{
:formats
=>
formats
},
prefix
,
true
)
end
end
end
actionpack/lib/action_view/render/rendering.rb
浏览文件 @
010a0c92
...
...
@@ -24,10 +24,10 @@ def render(options = {}, locals = {}, &block) #:nodoc:
return
_render_content
(
_render_partial
(
options
),
layout
,
options
[
:locals
])
end
layout
=
find
_by_parts
(
layout
,
{
:formats
=>
formats
})
if
layout
layout
=
find
(
layout
,
{
:formats
=>
formats
})
if
layout
if
file
=
options
[
:file
]
template
=
find
_by_parts
(
file
,
{
:formats
=>
formats
})
template
=
find
(
file
,
{
:formats
=>
formats
})
_render_template
(
template
,
layout
,
:locals
=>
options
[
:locals
]
||
{})
elsif
inline
=
options
[
:inline
]
_render_inline
(
inline
,
layout
,
options
)
...
...
actionpack/lib/action_view/template/resolver.rb
浏览文件 @
010a0c92
...
...
@@ -10,7 +10,7 @@ def initialize(options)
end
# Normalizes the arguments and passes it on to find_template
def
find
_by_parts
(
*
args
)
def
find
(
*
args
)
find_all_by_parts
(
*
args
).
first
end
...
...
actionpack/test/abstract_controller/abstract_controller_test.rb
浏览文件 @
010a0c92
...
...
@@ -139,10 +139,10 @@ class WithLayouts < PrefixedViews
private
def
self
.
layout
(
formats
)
begin
view_paths
.
find
_by_parts
(
name
.
underscore
,
{
:formats
=>
formats
},
"layouts"
)
view_paths
.
find
(
name
.
underscore
,
{
:formats
=>
formats
},
"layouts"
)
rescue
ActionView
::
MissingTemplate
begin
view_paths
.
find
_by_parts
(
"application"
,
{
:formats
=>
formats
},
"layouts"
)
view_paths
.
find
(
"application"
,
{
:formats
=>
formats
},
"layouts"
)
rescue
ActionView
::
MissingTemplate
end
end
...
...
actionpack/test/abstract_controller/helper_test.rb
浏览文件 @
010a0c92
...
...
@@ -4,7 +4,7 @@ module AbstractController
module
Testing
class
ControllerWithHelpers
<
AbstractController
::
Base
include
RenderingController
include
AbstractController
::
RenderingController
include
Helpers
def
render
(
string
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录