Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
60c8a03c
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,发现更多精彩内容 >>
未验证
提交
60c8a03c
编写于
1月 14, 2019
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove deprecated image_alt helper
上级
e70d3df7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
4 addition
and
43 deletion
+4
-43
actionview/CHANGELOG.md
actionview/CHANGELOG.md
+4
-0
actionview/lib/action_view/helpers/asset_tag_helper.rb
actionview/lib/action_view/helpers/asset_tag_helper.rb
+0
-23
actionview/test/template/asset_tag_helper_test.rb
actionview/test/template/asset_tag_helper_test.rb
+0
-20
未找到文件。
actionview/CHANGELOG.md
浏览文件 @
60c8a03c
*
Remove deprecated
`image_alt`
helper.
*Rafael Mendonça França*
*
Fix the need of
`#protect_against_forgery?`
method defined in
`ActionView::Base`
subclasses. This prevents the use of forms and buttons.
...
...
actionview/lib/action_view/helpers/asset_tag_helper.rb
浏览文件 @
60c8a03c
...
...
@@ -355,29 +355,6 @@ def image_tag(source, options = {})
tag
(
"img"
,
options
)
end
# Returns a string suitable for an HTML image tag alt attribute.
# The +src+ argument is meant to be an image file path.
# The method removes the basename of the file path and the digest,
# if any. It also removes hyphens and underscores from file names and
# replaces them with spaces, returning a space-separated, titleized
# string.
#
# ==== Examples
#
# image_alt('rails.png')
# # => Rails
#
# image_alt('hyphenated-file-name.png')
# # => Hyphenated file name
#
# image_alt('underscored_file_name.png')
# # => Underscored file name
def
image_alt
(
src
)
ActiveSupport
::
Deprecation
.
warn
(
"image_alt is deprecated and will be removed from Rails 6.0. You must explicitly set alt text on images."
)
File
.
basename
(
src
,
".*"
).
sub
(
/-[[:xdigit:]]{32,64}\z/
,
""
).
tr
(
"-_"
,
" "
).
capitalize
end
# Returns an HTML video tag for the +sources+. If +sources+ is a string,
# a single video tag will be returned. If +sources+ is an array, a video
# tag with nested source tags for each source will be returned. The
...
...
actionview/test/template/asset_tag_helper_test.rb
浏览文件 @
60c8a03c
...
...
@@ -512,26 +512,6 @@ def test_url_to_image_alias_for_image_url
UrlToImageToTag
.
each
{
|
method
,
tag
|
assert_dom_equal
(
tag
,
eval
(
method
))
}
end
def
test_image_alt
[
nil
,
"/"
,
"/foo/bar/"
,
"foo/bar/"
].
each
do
|
prefix
|
assert_deprecated
do
assert_equal
"Rails"
,
image_alt
(
"
#{
prefix
}
rails.png"
)
end
assert_deprecated
do
assert_equal
"Rails"
,
image_alt
(
"
#{
prefix
}
rails-9c0a079bdd7701d7e729bd956823d153.png"
)
end
assert_deprecated
do
assert_equal
"Rails"
,
image_alt
(
"
#{
prefix
}
rails-f56ef62bc41b040664e801a38f068082a75d506d9048307e8096737463503d0b.png"
)
end
assert_deprecated
do
assert_equal
"Long file name with hyphens"
,
image_alt
(
"
#{
prefix
}
long-file-name-with-hyphens.png"
)
end
assert_deprecated
do
assert_equal
"Long file name with underscores"
,
image_alt
(
"
#{
prefix
}
long_file_name_with_underscores.png"
)
end
end
end
def
test_image_tag
ImageLinkToTag
.
each
{
|
method
,
tag
|
assert_dom_equal
(
tag
,
eval
(
method
))
}
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录