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

Feature Request: Add Support to Customize Input Mappings #1799

Open
klondikemarlen opened this issue Dec 2, 2022 · 0 comments
Open

Feature Request: Add Support to Customize Input Mappings #1799

klondikemarlen opened this issue Dec 2, 2022 · 0 comments

Comments

@klondikemarlen
Copy link

Precheck

  • Do not use the issues tracker for help or support, try Stack Overflow.
  • For bugs, do a quick search and make sure the bug has not yet been reported
  • If you found a security bug, do not report it through GitHub. Please send an e-mail to heartcombo@googlegroups.com instead.
  • Finally, be nice and have fun!

Environment

  • Ruby 3.1.2
  • Rails 7.0.4
  • Simple Form 5.1.0

Current behavior

If I want to customize the search input, e.g. f.input(:search, as: :search), I can't do so in a comfortable way.
I can do f.input(:search, as: :custom_search) and build a CustomSearchInput < SimpleForm::Inputs::StringInput, but this doesn't feel very natural.
I can also do SimpleForm::FormBuilder.mappings[:search] = CustomSearchInput, but this doesn't use a public interface.

Expected behavior

To be able to tweak the default SimpleForm::FormBuilder.mappings[:search] via a config option.
e.g.

# config/initializers/simple_form.rb
SimpleForm.setup do |config|
  config.form_builder_input_mappings = {
    search: CustomSearchInput,
  }
end
@klondikemarlen klondikemarlen changed the title Feature Request: Add Support to Cusomize Input Mappings Feature Request: Add Support to Customize Input Mappings Dec 2, 2022
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