Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c4276ddf
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,发现更多精彩内容 >>
提交
c4276ddf
编写于
10月 15, 2012
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ignore asset url query string or anchor when appending extensions and computing public path
上级
046ab843
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
2 deletion
+21
-2
actionpack/lib/action_view/helpers/asset_url_helper.rb
actionpack/lib/action_view/helpers/asset_url_helper.rb
+3
-1
actionpack/test/template/asset_tag_helper_test.rb
actionpack/test/template/asset_tag_helper_test.rb
+18
-1
未找到文件。
actionpack/lib/action_view/helpers/asset_url_helper.rb
浏览文件 @
c4276ddf
...
...
@@ -122,6 +122,8 @@ def asset_path(source, options = {})
return
""
unless
source
.
present?
return
source
if
source
=~
URI_REGEXP
tail
,
source
=
source
[
/([\?#].+)$/
],
source
.
sub
(
/([\?#].+)$/
,
''
)
if
extname
=
compute_asset_extname
(
source
,
options
)
source
=
"
#{
source
}#{
extname
}
"
end
...
...
@@ -140,7 +142,7 @@ def asset_path(source, options = {})
source
=
"
#{
host
}#{
source
}
"
end
source
"
#{
source
}#{
tail
}
"
end
alias_method
:path_to_asset
,
:asset_path
# aliased to avoid conflicts with a asset_path named route
...
...
actionpack/test/template/asset_tag_helper_test.rb
浏览文件 @
c4276ddf
...
...
@@ -73,7 +73,12 @@ def url_for(*args)
%(javascript_path("super/xmlhr"))
=>
%(/javascripts/super/xmlhr.js)
,
%(javascript_path("/super/xmlhr.js"))
=>
%(/super/xmlhr.js)
,
%(javascript_path("xmlhr.min"))
=>
%(/javascripts/xmlhr.min.js)
,
%(javascript_path("xmlhr.min.js"))
=>
%(/javascripts/xmlhr.min.js)
%(javascript_path("xmlhr.min.js"))
=>
%(/javascripts/xmlhr.min.js)
,
%(javascript_path("xmlhr.js?123"))
=>
%(/javascripts/xmlhr.js?123)
,
%(javascript_path("xmlhr.js?body=1"))
=>
%(/javascripts/xmlhr.js?body=1)
,
%(javascript_path("xmlhr.js#hash"))
=>
%(/javascripts/xmlhr.js#hash)
,
%(javascript_path("xmlhr.js?123#hash"))
=>
%(/javascripts/xmlhr.js?123#hash)
}
PathToJavascriptToTag
=
{
...
...
@@ -285,6 +290,14 @@ def url_for(*args)
%(audio_tag(["audio.mp3", "audio.ogg"], :autobuffer => true, :controls => true))
=>
%(<audio autobuffer="autobuffer" controls="controls"><source src="/audios/audio.mp3" /><source src="/audios/audio.ogg" /></audio>)
}
FontPathToTag
=
{
%(font_path("font.eot"))
=>
%(/fonts/font.eot)
,
%(font_path("font.eot#iefix"))
=>
%(/fonts/font.eot#iefix)
,
%(font_path("font.woff"))
=>
%(/fonts/font.woff)
,
%(font_path("font.ttf"))
=>
%(/fonts/font.ttf)
,
%(font_path("font.ttf?123"))
=>
%(/fonts/font.ttf?123)
}
def
test_autodiscovery_link_tag_deprecated_types
result
=
nil
assert_deprecated
do
...
...
@@ -466,6 +479,10 @@ def test_audio_tag
AudioLinkToTag
.
each
{
|
method
,
tag
|
assert_dom_equal
(
tag
,
eval
(
method
))
}
end
def
test_font_path
FontPathToTag
.
each
{
|
method
,
tag
|
assert_dom_equal
(
tag
,
eval
(
method
))
}
end
def
test_video_audio_tag_does_not_modify_options
options
=
{
:autoplay
=>
true
}
video_tag
(
'video'
,
options
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录