I am working on some custom styling around boolean form inputs. I would like to be able to use the default boolean input to achieve two outcomes depending on options passed.
setting config.boolean_style = :inline and using custom wrapper
I could not get this to render a <label> with the proper arguments and no text.
adding a custom input that was also a boolean
This did work, however seemed very heavy handed for such a small desire
I ended up Overwriting inputs/boolean_input.rb to allow passing a blank string to render a blank tag. by adding a options[:label] == '' check to inputs/boolean_input.rb:22
This still feels heavy handed for this. I've looked for a simpler answer to this but have not been able to find anything after quite a while searching. Is there something I am missing by chance?
If I am not missing something and this is not possible, would this be a feature you be interested in adding? Or is there a reason I am not aware of as to why this is not possible?
Thank you in advance for your time and assistance.
I am working on some custom styling around boolean form inputs. I would like to be able to use the default boolean input to achieve two outcomes depending on options passed.
Outcome A:
Render a inline boolean with a normal label via:
Outcome B:
Render an inline boolean with a blank
<label>
tag so I can continue to show my custom CSS checkbox.This causes the label to be removed all together
This causes the label to pull the name from the field
I've tried
config.boolean_style = :inline
and using custom wrapper<label>
with the proper arguments and no text.I ended up Overwriting
inputs/boolean_input.rb
to allow passing a blank string to render a blank tag. by adding aoptions[:label] == ''
check toinputs/boolean_input.rb:22
This still feels heavy handed for this. I've looked for a simpler answer to this but have not been able to find anything after quite a while searching. Is there something I am missing by chance?
If I am not missing something and this is not possible, would this be a feature you be interested in adding? Or is there a reason I am not aware of as to why this is not possible?
Thank you in advance for your time and assistance.
Environment