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

Update install generator for Bootstrap 5 #1738

Merged
merged 2 commits into from
Mar 7, 2022
Merged

Conversation

mhw
Copy link
Contributor

@mhw mhw commented May 28, 2021

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

@m5o
Copy link
Contributor

m5o commented May 28, 2021

👀 #1729 maybe could become interesting with the issue around .has-validation for input groups

@oTiMo
Copy link

oTiMo commented Jun 23, 2021

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|

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.

Copy link
Contributor Author

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.

@oTiMo
Copy link

oTiMo commented Jul 19, 2021

When do you think this branch will be merged?

@o-t-w
Copy link

o-t-w commented Oct 11, 2021

So this gem doesn't use Bootstrap 5 by default? How do I use Bootstrap 5 with this gem?

@carlosantoniodasilva
Copy link
Member

@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)

@collimarco
Copy link

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 btn is completely white (and it doesn't look like a button), maybe it should be set to btn-primary by default?

@jamgregory
Copy link

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? 🤞

@nashby nashby merged commit 1535f32 into heartcombo:main Mar 7, 2022
@nashby
Copy link
Collaborator

nashby commented Mar 7, 2022

@mhw thank you!

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

Successfully merging this pull request may close these issues.

None yet

9 participants