Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
e4b233a2
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,发现更多精彩内容 >>
提交
e4b233a2
编写于
6月 15, 2016
作者:
S
schneems
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add public URL helpers
上级
5b576af9
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
56 addition
and
0 deletion
+56
-0
actionview/lib/action_view/helpers/asset_url_helper.rb
actionview/lib/action_view/helpers/asset_url_helper.rb
+56
-0
未找到文件。
actionview/lib/action_view/helpers/asset_url_helper.rb
浏览文件 @
e4b233a2
...
...
@@ -188,6 +188,14 @@ def asset_url(source, options = {})
end
alias_method
:url_to_asset
,
:asset_url
# aliased to avoid conflicts with an asset_url named route
# Computes the full URL to a asset in the public folder.
# This uses +asset_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def
public_asset_url
(
source
,
options
=
{})
url_to_asset
(
source
,
{
public_folder:
true
}.
merge!
(
options
))
end
alias_method
:path_to_public_asset
,
:public_asset_path
# aliased to avoid conflicts with an asset_path named route
ASSET_EXTENSIONS
=
{
javascript:
".js"
,
stylesheet:
".css"
...
...
@@ -291,6 +299,14 @@ def javascript_url(source, options = {})
end
alias_method
:url_to_javascript
,
:javascript_url
# aliased to avoid conflicts with a javascript_url named route
# Computes the full URL to a javascript asset in the public folder.
# This uses +javascript_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def
public_javascript_url
(
source
,
options
=
{})
url_to_javascript
(
source
,
{
public_folder:
true
}.
merge!
(
options
))
end
alias_method
:path_to_public_javascript
,
:public_javascript_path
# aliased to avoid conflicts with an javascript_path named route
# Computes the path to a stylesheet asset in the public stylesheets directory.
# If the +source+ filename has no extension, .css will be appended (except for explicit URIs).
# Full paths from the document root will be passed through.
...
...
@@ -323,6 +339,14 @@ def stylesheet_url(source, options = {})
end
alias_method
:url_to_stylesheet
,
:stylesheet_url
# aliased to avoid conflicts with a stylesheet_url named route
# Computes the full URL to a stylesheet asset in the public folder.
# This uses +stylesheet_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def
public_stylesheet_url
(
source
,
options
=
{})
url_to_stylesheet
(
source
,
{
public_folder:
true
}.
merge!
(
options
))
end
alias_method
:path_to_public_stylesheet
,
:public_stylesheet_path
# aliased to avoid conflicts with an stylesheet_path named route
# Computes the path to an image asset.
# Full paths from the document root will be passed through.
# Used internally by +image_tag+ to build the image path:
...
...
@@ -358,6 +382,14 @@ def image_url(source, options = {})
end
alias_method
:url_to_image
,
:image_url
# aliased to avoid conflicts with an image_url named route
# Computes the full URL to a image asset in the public folder.
# This uses +image_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def
public_image_url
(
source
,
options
=
{})
url_to_image
(
source
,
{
public_folder:
true
}.
merge!
(
options
))
end
alias_method
:path_to_public_image
,
:public_image_path
# aliased to avoid conflicts with an image_path named route
# Computes the path to a video asset in the public videos directory.
# Full paths from the document root will be passed through.
# Used internally by +video_tag+ to build the video path.
...
...
@@ -389,6 +421,14 @@ def video_url(source, options = {})
end
alias_method
:url_to_video
,
:video_url
# aliased to avoid conflicts with an video_url named route
# Computes the full URL to a video asset in the public folder.
# This uses +video_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def
public_video_url
(
source
,
options
=
{})
url_to_video
(
source
,
{
public_folder:
true
}.
merge!
(
options
))
end
alias_method
:path_to_public_video
,
:public_video_path
# aliased to avoid conflicts with an video_path named route
# Computes the path to an audio asset in the public audios directory.
# Full paths from the document root will be passed through.
# Used internally by +audio_tag+ to build the audio path.
...
...
@@ -420,6 +460,14 @@ def audio_url(source, options = {})
end
alias_method
:url_to_audio
,
:audio_url
# aliased to avoid conflicts with an audio_url named route
# Computes the full URL to a audio asset in the public folder.
# This uses +audio_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def
public_audio_url
(
source
,
options
=
{})
url_to_audio
(
source
,
{
public_folder:
true
}.
merge!
(
options
))
end
alias_method
:path_to_public_audio
,
:public_audio_path
# aliased to avoid conflicts with an audio_path named route
# Computes the path to a font asset.
# Full paths from the document root will be passed through.
#
...
...
@@ -449,6 +497,14 @@ def font_url(source, options = {})
url_to_asset
(
source
,
{
type: :font
}.
merge!
(
options
))
end
alias_method
:url_to_font
,
:font_url
# aliased to avoid conflicts with an font_url named route
# Computes the full URL to a font asset in the public folder.
# This uses +font_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def
public_font_url
(
source
,
options
=
{})
url_to_font
(
source
,
{
public_folder:
true
}.
merge!
(
options
))
end
alias_method
:path_to_public_font
,
:public_font_path
# aliased to avoid conflicts with an public_font_url named route
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录