plataformatec/simple_form — pull request #1073 by IanVaughan (2014-05-28 11:59:33+00:00)
Title: Only output the wrapper if the block yields content

This is the same PR as https://github.com/plataformatec/simple_form/pull/1072, but back-ported for the v2.1 branch.

----

This change allows the wrappers to not output its HTML when when the block yields no content.

e.g. when defining an optional component :
```ruby
ba.wrapper tag: :div, class: 'form-helper -message -hint' do |bb|
bb.optional :hint, wrap_with: { tag: :p }
end
```
and that component is not used in a template :
```erb
<%= form.input :name %>
```
Then the HTML output still contains the wrapper output :
```html

```
If this behaviour is not desired, then the output of the empty tags can be disabled via the `remove_empty` option.
```ruby
ba.wrapper tag: :div, class: 'form-helper -message -hint', remove_empty: true do |bb|
bb.optional :hint, wrap_with: { tag: :p }
end
```
The above config will not output any wrapper HTML.