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

Already on GitHub? Sign in to your account

Support default wrappers for specific field mappings #636

Closed
dw2 opened this Issue Jul 28, 2012 · 5 comments

Comments

Projects
None yet
4 participants
Contributor

dw2 commented Jul 28, 2012

For example, I'd like to create custom wrappers for each of the field mappings that I use in a form. I may want to set things up differently for checkboxes, vs radio buttons, vs normal input fields. Right now, I have to pass the custom wrapper name every for every field. It would be nice if I could write something like this: config.default_wrapper :my_text_wrapper, :for => :text, where :text refers to the mapped input type :text.

Contributor

dw2 commented Jul 28, 2012

Better yet: if a custom wrapper has the same name as one of the mapped input fields, just use the matching named custom wrapper by default. So if I have custom wrapped named :range, then an "f.input :as => :range" fields would use the range wrapper instead of the default one.

Collaborator

rafaelfranca commented Jul 28, 2012

Yes, this seems a resonable feature request. Lets wait more feedback.

@carlosantoniodasilva @lucasmazza @josevalim this make sense to you?

Contributor

dw2 commented Jul 28, 2012

I forked the repo and implemented the feature. Tests would still need to be written. You can check it out here:

dw2/simple_form@cb59268

Collaborator

carlosantoniodasilva commented Aug 11, 2012

I'm kinda against making the "default naming" just works, although it looks cool at a glance, I think it may confuse people that won't get at first what's going on with a particular input type that has changed the way it's rendered just because "by chance" some wrapper with the type name was added.

I think the best path would be to allow configuring it similarly as we do with input mappings.

Collaborator

nashby commented Sep 7, 2012

@dw2 Hi! This feature was implemented in #642. Could grab SimpleForm from master and test it? Thank you!

@nashby nashby closed this Sep 7, 2012

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