提交 9fbb1767 编写于 作者: S Sergey Nartimov

add include_hidden option to checkbox tag

上级 a85714a6
......@@ -25,9 +25,15 @@ def render
add_default_name_and_id(options)
end
hidden = hidden_field_for_checkbox(options)
include_hidden = options.delete("include_hidden") { true }
checkbox = tag("input", options)
hidden + checkbox
if include_hidden
hidden = hidden_field_for_checkbox(options)
hidden + checkbox
else
checkbox
end
end
private
......
......@@ -387,6 +387,11 @@ def test_check_box
)
end
def test_check_box_with_include_hidden_false
@post.secret = false
assert_dom_equal('<input id="post_secret" name="post[secret]" type="checkbox" value="1" />', check_box("post", "secret", :include_hidden => false))
end
def test_check_box_with_explicit_checked_and_unchecked_values
@post.secret = "on"
assert_dom_equal(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册