Allow wrapper tag to be given on demand.
This commit is contained in:
parent
ac85052e33
commit
0dd61968a9
|
@ -1,13 +1,10 @@
|
|||
== General
|
||||
|
||||
* Sample CSS
|
||||
* Get default string options from column definition
|
||||
* Add support to default :prompt methods on datetime inputs
|
||||
* Add support to default label method
|
||||
* Add support to f.label, f.error and f.hint calls
|
||||
* Improve readme with examples
|
||||
* :country, :time_zone, :group and :file types support
|
||||
* Allow required to come after or before the label
|
||||
|
||||
== Associations
|
||||
|
||||
|
|
|
@ -6,8 +6,10 @@ module SimpleForm
|
|||
include RequiredHelpers
|
||||
|
||||
def call
|
||||
if SimpleForm.wrapper_tag
|
||||
template.content_tag(SimpleForm.wrapper_tag, @component.call, component_html_options)
|
||||
tag = options[:wrapper] || SimpleForm.wrapper_tag
|
||||
|
||||
if tag
|
||||
template.content_tag(tag, @component.call, component_html_options)
|
||||
else
|
||||
@component.call
|
||||
end
|
||||
|
|
|
@ -160,6 +160,13 @@ class FormBuilderTest < ActionView::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test 'builder allows wrapper tag to be given on demand' do
|
||||
simple_form_for @user do |f|
|
||||
concat f.input :name, :wrapper => :b
|
||||
end
|
||||
assert_select 'form b.required.string'
|
||||
end
|
||||
|
||||
test 'nested simple fields should yields an instance of FormBuilder' do
|
||||
simple_form_for :user do |f|
|
||||
f.simple_fields_for :posts do |posts_form|
|
||||
|
|
Loading…
Reference in New Issue