Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
ac86cbec
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,发现更多精彩内容 >>
提交
ac86cbec
编写于
1月 08, 2013
作者:
S
Steve Klabnik
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8810 from NARKOZ/image-submit-tag
set 'alt' attribute for image_submit_tag
上级
cc1c3c5b
0f8f75c8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
9 deletion
+14
-9
actionpack/CHANGELOG.md
actionpack/CHANGELOG.md
+5
-0
actionpack/lib/action_view/helpers/form_tag_helper.rb
actionpack/lib/action_view/helpers/form_tag_helper.rb
+7
-7
actionpack/test/template/form_tag_helper_test.rb
actionpack/test/template/form_tag_helper_test.rb
+2
-2
未找到文件。
actionpack/CHANGELOG.md
浏览文件 @
ac86cbec
## Rails 4.0.0 (unreleased) ##
*
`image_submit_tag`
will set
`alt`
attribute from image source if not
specified.
*Nihad Abbasov*
*
Do not generate local variables for partials without object or collection.
Previously rendering a partial without giving
`:object`
or
`:collection`
would generate a local variable with the partial name by default.
...
...
actionpack/lib/action_view/helpers/form_tag_helper.rb
浏览文件 @
ac86cbec
...
...
@@ -526,19 +526,19 @@ def button_tag(content_or_options = nil, options = nil, &block)
#
# ==== Examples
# image_submit_tag("login.png")
# # => <input src="/images/login.png" type="image" />
# # => <input
alt="Login"
src="/images/login.png" type="image" />
#
# image_submit_tag("purchase.png", disabled: true)
# # => <input disabled="disabled" src="/images/purchase.png" type="image" />
# # => <input
alt="Purchase"
disabled="disabled" src="/images/purchase.png" type="image" />
#
# image_submit_tag("search.png", class: 'search_button')
# # => <input class="search_button" src="/images/search.png" type="image" />
# image_submit_tag("search.png", class: 'search_button'
, alt: 'Find'
)
# # => <input
alt="Find"
class="search_button" src="/images/search.png" type="image" />
#
# image_submit_tag("agree.png", disabled: true, class: "agree_disagree_button")
# # => <input class="agree_disagree_button" disabled="disabled" src="/images/agree.png" type="image" />
# # => <input
alt="Agree"
class="agree_disagree_button" disabled="disabled" src="/images/agree.png" type="image" />
#
# image_submit_tag("save.png", data: { confirm: "Are you sure?" })
# # => <input src="/images/save.png" data-confirm="Are you sure?" type="image" />
# # => <input
alt="Save"
src="/images/save.png" data-confirm="Are you sure?" type="image" />
def
image_submit_tag
(
source
,
options
=
{})
options
=
options
.
stringify_keys
...
...
@@ -550,7 +550,7 @@ def image_submit_tag(source, options = {})
options
[
"data-confirm"
]
=
confirm
end
tag
:input
,
{
"type"
=>
"image"
,
"src"
=>
path_to_image
(
source
)
}.
update
(
options
)
tag
:input
,
{
"
alt"
=>
image_alt
(
source
),
"
type"
=>
"image"
,
"src"
=>
path_to_image
(
source
)
}.
update
(
options
)
end
# Creates a field set for grouping HTML form elements.
...
...
actionpack/test/template/form_tag_helper_test.rb
浏览文件 @
ac86cbec
...
...
@@ -488,7 +488,7 @@ def test_button_tag_with_deprecated_confirmation
def
test_image_submit_tag_with_confirmation
assert_dom_equal
(
%(<input type="image" src="/images/save.gif" data-confirm="Are you sure?" />)
,
%(<input
alt="Save"
type="image" src="/images/save.gif" data-confirm="Are you sure?" />)
,
image_submit_tag
(
"save.gif"
,
:data
=>
{
:confirm
=>
"Are you sure?"
})
)
end
...
...
@@ -496,7 +496,7 @@ def test_image_submit_tag_with_confirmation
def
test_image_submit_tag_with_deprecated_confirmation
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%(<input type="image" src="/images/save.gif" data-confirm="Are you sure?" />)
,
%(<input
alt="Save"
type="image" src="/images/save.gif" data-confirm="Are you sure?" />)
,
image_submit_tag
(
"save.gif"
,
:confirm
=>
"Are you sure?"
)
)
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录