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

Allow to set wrapper mappings when SimpleForm.setup #1757

Open
snkanta opened this issue Jan 14, 2022 · 0 comments
Open

Allow to set wrapper mappings when SimpleForm.setup #1757

snkanta opened this issue Jan 14, 2022 · 0 comments

Comments

@snkanta
Copy link

snkanta commented Jan 14, 2022

Like #1632, I want to specify different wrapper mappings for each wrapper of form.
So, I would like to be able to specify the wrapper mappings for the wrapper of form when SimpleForm.setup.

# config/initializers/simple_form.rb
SimpleForm.setup do |config|
  # ...

  horizontal_forms_mapping = {
    boolean:       :horizontal_boolean,
    check_boxes:   :horizontal_collection,
    date:          :horizontal_multi_select,
    datetime:      :horizontal_multi_select,
    file:          :horizontal_file,
    radio_buttons: :horizontal_collection,
    range:         :horizontal_range,
    time:          :horizontal_multi_select
  }

  # horizontal form wrapper
  config.wrappers :horizontal_form, tag: 'div', class: 'mb-4', wrapper_mappings: horizontal_forms_mapping do |b|
    b.use :html5
    b.use :placeholder

    # ...

  end

  # ...
end
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

1 participant