Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
77d8f7a4
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,发现更多精彩内容 >>
提交
77d8f7a4
编写于
3月 29, 2011
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Seperate asset directories
上级
651d371a
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
21 addition
and
16 deletion
+21
-16
actionpack/lib/action_view/helpers/sprockets_helper.rb
actionpack/lib/action_view/helpers/sprockets_helper.rb
+3
-1
actionpack/test/fixtures/sprockets/app/javascripts/application.js
...ck/test/fixtures/sprockets/app/javascripts/application.js
+0
-0
actionpack/test/fixtures/sprockets/app/javascripts/dir/xmlhr.js
...pack/test/fixtures/sprockets/app/javascripts/dir/xmlhr.js
+0
-0
actionpack/test/fixtures/sprockets/app/javascripts/xmlhr.js
actionpack/test/fixtures/sprockets/app/javascripts/xmlhr.js
+0
-0
actionpack/test/fixtures/sprockets/app/stylesheets/application.css
...k/test/fixtures/sprockets/app/stylesheets/application.css
+0
-0
actionpack/test/fixtures/sprockets/app/stylesheets/dir/style.css
...ack/test/fixtures/sprockets/app/stylesheets/dir/style.css
+0
-0
actionpack/test/fixtures/sprockets/app/stylesheets/style.css
actionpack/test/fixtures/sprockets/app/stylesheets/style.css
+0
-0
actionpack/test/template/sprockets_helper_test.rb
actionpack/test/template/sprockets_helper_test.rb
+18
-15
未找到文件。
actionpack/lib/action_view/helpers/sprockets_helper.rb
浏览文件 @
77d8f7a4
...
...
@@ -48,7 +48,9 @@ def compute_sprockets_path(source, dir, default_ext)
end
# Fingerprint url
source
=
assets
.
path
(
source
,
config
.
perform_caching
)
if
source
=~
/^\/
#{
dir
}
\/(.+)/
source
=
assets
.
path
(
$1
,
config
.
perform_caching
,
dir
)
end
host
=
compute_asset_host
(
source
)
...
...
actionpack/test/fixtures/sprockets/app/
assets/
javascripts/application.js
→
actionpack/test/fixtures/sprockets/app/javascripts/application.js
浏览文件 @
77d8f7a4
文件已移动
actionpack/test/fixtures/sprockets/app/
assets/
javascripts/dir/xmlhr.js
→
actionpack/test/fixtures/sprockets/app/javascripts/dir/xmlhr.js
浏览文件 @
77d8f7a4
文件已移动
actionpack/test/fixtures/sprockets/app/
assets/
javascripts/xmlhr.js
→
actionpack/test/fixtures/sprockets/app/javascripts/xmlhr.js
浏览文件 @
77d8f7a4
文件已移动
actionpack/test/fixtures/sprockets/app/
assets/
stylesheets/application.css
→
actionpack/test/fixtures/sprockets/app/stylesheets/application.css
浏览文件 @
77d8f7a4
文件已移动
actionpack/test/fixtures/sprockets/app/
assets/
stylesheets/dir/style.css
→
actionpack/test/fixtures/sprockets/app/stylesheets/dir/style.css
浏览文件 @
77d8f7a4
文件已移动
actionpack/test/fixtures/sprockets/app/
assets/
stylesheets/style.css
→
actionpack/test/fixtures/sprockets/app/stylesheets/style.css
浏览文件 @
77d8f7a4
文件已移动
actionpack/test/template/sprockets_helper_test.rb
浏览文件 @
77d8f7a4
...
...
@@ -20,7 +20,10 @@ def host_with_port() 'localhost' end
@controller
.
request
=
@request
@assets
=
Sprockets
::
Environment
.
new
@assets
.
paths
<<
FIXTURES
.
join
(
"sprockets/app/assets"
)
@assets
.
paths
<<
FIXTURES
.
join
(
"sprockets/app/javascripts"
)
@assets
.
paths
<<
FIXTURES
.
join
(
"sprockets/app/stylesheets"
)
config
.
perform_caching
=
true
end
def
url_for
(
*
args
)
...
...
@@ -28,12 +31,12 @@ def url_for(*args)
end
test
"javascript path"
do
assert_equal
"/
javascrip
ts/application-d41d8cd98f00b204e9800998ecf8427e.js"
,
assert_equal
"/
asse
ts/application-d41d8cd98f00b204e9800998ecf8427e.js"
,
sprockets_javascript_path
(
:application
)
assert_equal
"/
javascrip
ts/xmlhr-d41d8cd98f00b204e9800998ecf8427e.js"
,
assert_equal
"/
asse
ts/xmlhr-d41d8cd98f00b204e9800998ecf8427e.js"
,
sprockets_javascript_path
(
"xmlhr"
)
assert_equal
"/
javascrip
ts/dir/xmlhr-d41d8cd98f00b204e9800998ecf8427e.js"
,
assert_equal
"/
asse
ts/dir/xmlhr-d41d8cd98f00b204e9800998ecf8427e.js"
,
sprockets_javascript_path
(
"dir/xmlhr.js"
)
assert_equal
"/dir/xmlhr.js"
,
...
...
@@ -46,24 +49,24 @@ def url_for(*args)
end
test
"javascript include tag"
do
assert_equal
'<script src="/
javascrip
ts/application-d41d8cd98f00b204e9800998ecf8427e.js" type="text/javascript"></script>'
,
assert_equal
'<script src="/
asse
ts/application-d41d8cd98f00b204e9800998ecf8427e.js" type="text/javascript"></script>'
,
sprockets_javascript_include_tag
(
:application
)
assert_equal
'<script src="/
javascrip
ts/xmlhr-d41d8cd98f00b204e9800998ecf8427e.js" type="text/javascript"></script>'
,
assert_equal
'<script src="/
asse
ts/xmlhr-d41d8cd98f00b204e9800998ecf8427e.js" type="text/javascript"></script>'
,
sprockets_javascript_include_tag
(
"xmlhr"
)
assert_equal
'<script src="/
javascrip
ts/xmlhr-d41d8cd98f00b204e9800998ecf8427e.js" type="text/javascript"></script>'
,
assert_equal
'<script src="/
asse
ts/xmlhr-d41d8cd98f00b204e9800998ecf8427e.js" type="text/javascript"></script>'
,
sprockets_javascript_include_tag
(
"xmlhr.js"
)
assert_equal
'<script src="http://www.railsapplication.com/xmlhr" type="text/javascript"></script>'
,
sprockets_javascript_include_tag
(
"http://www.railsapplication.com/xmlhr"
)
end
test
"stylesheet path"
do
assert_equal
"/
styleshe
ets/application-d41d8cd98f00b204e9800998ecf8427e.css"
,
assert_equal
"/
ass
ets/application-d41d8cd98f00b204e9800998ecf8427e.css"
,
sprockets_stylesheet_path
(
:application
)
assert_equal
"/
styleshe
ets/style-d41d8cd98f00b204e9800998ecf8427e.css"
,
assert_equal
"/
ass
ets/style-d41d8cd98f00b204e9800998ecf8427e.css"
,
sprockets_stylesheet_path
(
"style"
)
assert_equal
"/
styleshe
ets/dir/style-d41d8cd98f00b204e9800998ecf8427e.css"
,
assert_equal
"/
ass
ets/dir/style-d41d8cd98f00b204e9800998ecf8427e.css"
,
sprockets_stylesheet_path
(
"dir/style.css"
)
assert_equal
"/dir/style.css"
,
sprockets_stylesheet_path
(
"/dir/style.css"
)
...
...
@@ -75,19 +78,19 @@ def url_for(*args)
end
test
"stylesheet link tag"
do
assert_equal
'<link href="/
styleshe
ets/application-d41d8cd98f00b204e9800998ecf8427e.css" media="screen" rel="stylesheet" type="text/css" />'
,
assert_equal
'<link href="/
ass
ets/application-d41d8cd98f00b204e9800998ecf8427e.css" media="screen" rel="stylesheet" type="text/css" />'
,
sprockets_stylesheet_link_tag
(
:application
)
assert_equal
'<link href="/
styleshe
ets/style-d41d8cd98f00b204e9800998ecf8427e.css" media="screen" rel="stylesheet" type="text/css" />'
,
assert_equal
'<link href="/
ass
ets/style-d41d8cd98f00b204e9800998ecf8427e.css" media="screen" rel="stylesheet" type="text/css" />'
,
sprockets_stylesheet_link_tag
(
"style"
)
assert_equal
'<link href="/
styleshe
ets/style-d41d8cd98f00b204e9800998ecf8427e.css" media="screen" rel="stylesheet" type="text/css" />'
,
assert_equal
'<link href="/
ass
ets/style-d41d8cd98f00b204e9800998ecf8427e.css" media="screen" rel="stylesheet" type="text/css" />'
,
sprockets_stylesheet_link_tag
(
"style.css"
)
assert_equal
'<link href="http://www.railsapplication.com/style.css" media="screen" rel="stylesheet" type="text/css" />'
,
sprockets_stylesheet_link_tag
(
"http://www.railsapplication.com/style.css"
)
assert_equal
'<link href="/
styleshe
ets/style-d41d8cd98f00b204e9800998ecf8427e.css" media="all" rel="stylesheet" type="text/css" />'
,
assert_equal
'<link href="/
ass
ets/style-d41d8cd98f00b204e9800998ecf8427e.css" media="all" rel="stylesheet" type="text/css" />'
,
sprockets_stylesheet_link_tag
(
"style"
,
:media
=>
"all"
)
assert_equal
'<link href="/
styleshe
ets/style-d41d8cd98f00b204e9800998ecf8427e.css" media="print" rel="stylesheet" type="text/css" />'
,
assert_equal
'<link href="/
ass
ets/style-d41d8cd98f00b204e9800998ecf8427e.css" media="print" rel="stylesheet" type="text/css" />'
,
sprockets_stylesheet_link_tag
(
"style"
,
:media
=>
"print"
)
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录