"hide_label: true" on select element does not update the element's parent div class to col-sm-12.
Hello! Really digging this gem so far, but I have a question:
# in my view:
f.select :parent_id, options_for_parents(@page), {}, hide_label: true
<!-- Generated HTML from the view: -->
<div class="form-group">
<label class="sr-only col-sm-2 control-label" for="page_parent_id">Hoofdniveau</label>
<div class="col-sm-10">
<select class="form-control" id="page_parent_id" name="page[parent_id]">
...
</select>
</div>
</div>
I was wondering if there is a way with the current codebase to circumvent the behaviour so that whenever I set hide_label: true, it will change the select parent's class to col-sm-12 instead of col-sm-10. I can do it with a few lines of JavaScript, but would prefer it in Ruby.
This is what I would like to end up with:
<div class="form-group">
<!-- The label may be removed in this case -->
<div class="col-sm-12">
<select class="form-control" id="page_parent_id" name="page[parent_id]">
...
</select>
</div>
</div>
hi @davelens, currently there isn't a way to do this without hacking it.
I've thought about adding the ability to mix styles (both stacked and horizontal), which would allow you to use a stacked control for the parent_id and then hide the label so it effectively takes up the entire width.
However, we're currently working on merging this gem with bootstrap_forms over at https://github.com/bootstrap-ruby/rails-bootstrap-forms, so I'm not sure if this is something we'd be able to get to for a while.
Alright, thank you for the reply!
I'll close this and work around it with JS for now.