-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Update install generator for Bootstrap 5 #1738
Conversation
👀 #1729 maybe could become interesting with the issue around |
Thank you for this PR ! |
end | ||
end | ||
|
||
# vertical input for radio buttons and check boxes | ||
config.wrappers :vertical_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b| | ||
config.wrappers :vertical_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', tag: 'fieldset', class: 'mb-3' do |b| | ||
b.use :html5 | ||
b.optional :readonly | ||
b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found with bootstrap 5, the reboot css has float: left
applied to legend
elements. See twbs/bootstrap#30345. It adds a clear: left
to the next element, but in rails adds an auxiliary hidden field before every collection of radio buttons, which the clear: left
gets applied, but since it's hidden has no effect. I fixed this by adding float-none
class to this list, though I'm not sure that is the best solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I found the same issue when I was preparing this in the simple_form-bootstrap
project. I addressed it with an additional css rule that targets the first following div.form-check
. I'd wondered about submitting this upstream but haven't done so yet.
When do you think this branch will be merged? |
So this gem doesn't use Bootstrap 5 by default? How do I use Bootstrap 5 with this gem? |
@o-t-w we don't have this in the main repo yet, which is my fault for not having finished reviewing the change... I'll get to this soon. Anyway, all you need is the initializer that comes with this PR, you should be able to copy it from the app where it's kept current: https://github.com/heartcombo/simple_form-bootstrap/blob/master/config/initializers/simple_form_bootstrap.rb (we just bundle the initializer with SF to make it simpler to install upfront) |
Nice to find this issue... I was really wondering what was wrong with my configuration, since the design was broken with Bootstrap 5 in a new app. It seems that copying the new initializer solves most issues, Thanks!! The only strange thing is that the |
I've just come across this issue when generating a new Rails application that uses Bootstrap 5 and realising that Simple Form doesn't have Bootstrap 5 support yet. @carlosantoniodasilva - I don't suppose you know when this might be merged in and released? 🤞 |
@mhw thank you! |
This syncs up the generator template with the new one from
simple_form-bootstrap
.There's a minor issue with the styling of validation errors in input groups that I'd like to look at, but I don't think we need to wait for that before merging this in.
/cc @m5o