Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
e7c3eb11
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,发现更多精彩内容 >>
提交
e7c3eb11
编写于
10月 24, 2019
作者:
I
Iago Pimenta
提交者:
John Hawthorn
1月 09, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use default order of PathResolver::EXTENSIONS for sort templates
上级
4a477c0e
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
26 addition
and
1 deletion
+26
-1
actionview/CHANGELOG.md
actionview/CHANGELOG.md
+5
-0
actionview/lib/action_view/template/resolver.rb
actionview/lib/action_view/template/resolver.rb
+1
-1
actionview/test/template/resolver_shared_tests.rb
actionview/test/template/resolver_shared_tests.rb
+20
-0
未找到文件。
actionview/CHANGELOG.md
浏览文件 @
e7c3eb11
*
`OptimizedFileSystemResolver`
prefers template details in order of locale,
formats, variants, handlers.
*Iago Pimenta*
*
Added
`class_names`
helper to create a CSS class value with conditional classes.
*Joel Hawksley*, *Aaron Patterson*
...
...
actionview/lib/action_view/template/resolver.rb
浏览文件 @
e7c3eb11
...
...
@@ -335,7 +335,7 @@ def find_template_paths_from_details(path, details)
# We can use the matches found by the regex and sort by their index in
# details.
match
=
filename
.
match
(
regex
)
EXTENSIONS
.
keys
.
reverse
.
map
do
|
ext
|
EXTENSIONS
.
keys
.
map
do
|
ext
|
if
ext
==
:variants
&&
details
[
ext
]
==
:any
match
[
ext
].
nil?
?
0
:
1
elsif
match
[
ext
].
nil?
...
...
actionview/test/template/resolver_shared_tests.rb
浏览文件 @
e7c3eb11
...
...
@@ -146,6 +146,26 @@ def test_templates_with_optional_locale_shares_common_object
assert_same
en
[
0
],
fr
[
1
]
end
def
test_templates_sort_by_formats_json_first
with_file
"test/hello_world.html.erb"
,
"Hello HTML!"
with_file
"test/hello_world.json.jbuilder"
,
"Hello JSON!"
templates
=
resolver
.
find_all
(
"hello_world"
,
"test"
,
false
,
locale:
[],
formats:
[
:json
,
:html
],
variants: :any
,
handlers:
[
:erb
,
:jbuilder
])
assert_equal
2
,
templates
.
size
assert_equal
"Hello JSON!"
,
templates
[
0
].
source
end
def
test_templates_sort_by_formats_html_first
with_file
"test/hello_world.html.erb"
,
"Hello HTML!"
with_file
"test/hello_world.json.jbuilder"
,
"Hello JSON!"
templates
=
resolver
.
find_all
(
"hello_world"
,
"test"
,
false
,
locale:
[],
formats:
[
:html
,
:json
],
variants: :any
,
handlers:
[
:erb
,
:jbuilder
])
assert_equal
2
,
templates
.
size
assert_equal
"Hello HTML!"
,
templates
[
0
].
source
end
def
test_virtual_path_is_preserved_with_dot
with_file
"test/hello_world.html.erb"
,
"Hello html!"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录