Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement wrapper sets instead of mappings #1229

Closed
heaven opened this issue Mar 24, 2015 · 1 comment
Closed

Implement wrapper sets instead of mappings #1229

heaven opened this issue Mar 24, 2015 · 1 comment

Comments

@heaven
Copy link

heaven commented Mar 24, 2015

https://github.com/rafaelfranca/simple_form-bootstrap/blob/master/app/views/examples/_horizontal_form_sf.html.erb#L3

This looks more like a hack, instead there could be an ability to bound wrappers with a "set" or a "style" (e.g. set named :horizontal). So in views users would simply do something like:

= simple_form_for @model, wrapper: :a_custom_wrapper, set: :horizontal

So devs would be able to override the wrapper and specify a set name so simple_form does know which wrappers to use for field types.

Inside the config this could look like:

config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
  b.set :horizontal # set name
  b.map :boolean # field type

  #...
end

The approach with wrapper_mappings could be useful in some specific situations, but is not very convenient to use it more often.

@feliperenan
Copy link
Collaborator

It's been a long time since that this issue was open and I don't if it is issue yet, so I'm closing it. Feel free to reopen it if it's necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants