Simple_form: Add generator for bootstrap4

Created on 27 Dec 2015  路  14Comments  路  Source: heartcombo/simple_form

Bootstrap 4 will be there soon and some form related things changes.
For a list of changes see http://v4-alpha.getbootstrap.com/migration/#forms

Please add a new generator for bootstrap4.

Maybe as a new option rails generate simple_form:install --bootstrap4? Also a note/warning at the end of the default "--bootstrap" call would be got, something like "You just generated the form styles for bootstrap3. Should you require bootstrap4 styles, re-run the generator with rails "generate simple_form:install --bootstrap4 --force"."

Update:

I started the work over here, please feel free to pick it up https://github.com/plataformatec/simple_form/pull/1337

Most helpful comment

@tordans For me, the issue (Add generator for Bootstrap 4) was resolved so we can keep it closed.

I agree with you, we have some work to do about Bootstrap and I include the Foundation as well. IMHO we can remove the initializers and definitely remove the support for it, but I want to see other opinions about it. I will open another issue explaining the motivations and we can discuss it there.

@technodrome You can use Simple Form with Bootstrap 4 but some things maybe will not work, we are working on it - making Simple Form flexible enough to work with any CSS framework. When we talk about don't support Bootstrap anymore, we are talking about Simple Form generating the configuration out-of-the-box.

All 14 comments

There is new information about one of the open details at https://github.com/twbs/bootstrap/issues/18705#issuecomment-168248128

class="form-group" should be changed to class="form-group row"

Is this going to be added as an option? I would like to see this made as Bootstrap 4 is very nice with flexbox additions.

As bootstrap 4 is officially released would seem like a good time to update bootstap generator?

New Migration info here - https://getbootstrap.com/docs/4.0/migration/

+1 Bootstrap 4 official version is now released.

Are there plans to support this or has anyone done this already? New to simple_forms as been using formtastic, but a bit surprised that BS4 isn't supported already. I could potentially do this but looking at previous comments it looks like some changes to simple_form internals are required to support the changes...

any updates on this?

It would be great to have bootstrap 4 support. Booleans currently don't render correctly.
screen shot 2018-02-07 at 9 51 56 pm
It should look like the booleans from the bootstrap documents. https://getbootstrap.com/docs/4.0/components/forms/

The direction we intend to follow is to decouple simple form from any CSS framework, so that specific gems can be created to support them better.
Please take a look at https://github.com/plataformatec/simple_form/pull/1337#issuecomment-350709787

Closing it since we won't add support to Bootstrap 4.

We are working on simple_form-boostrap to update to Bootstrap 4 and making Simple Form flexible to support it. Feel free to join to us.

Thanks

@feliperenan its great to see progress in this other repo. However, I still think this Repo should have an open issue that people can find and understand whats going on. This repo still needs to be updates about bootstrap 4, eg:

Also, https://github.com/rafaelfranca/simple_form-bootstrap/pull/56 seems to be depending on some special version of simple form (see https://github.com/rafaelfranca/simple_form-bootstrap/pull/56/files#diff-8b7db4d5cc4b8f6dc8feb7030baa2478R72).

+gem 'simple_form', github: 'm5o/simple_form', branch: 'css_on_wrapper_when_valid-v2'

So are there plans now to merge external changes into simple_form? In one of those open tickets the questions was answered with 'no'.

Also, rafaelfranca/simple_form-bootstrap#56 seems to be depending on some special version of simple form (see https://github.com/rafaelfranca/simple_form-bootstrap/pull/56/files#diff-8b7db4d5cc4b8f6dc8feb7030baa2478R72).

This is just temporary and for demo purposes, including a feature request (https://github.com/plataformatec/simple_form/pull/1559) about having valid_class on input elements also which now has it's own PR.

valid_class

@m5o Thanks. Wouldn't it be nice to also be able to remove those spacer-hacks that you added at https://github.com/rafaelfranca/simple_form-bootstrap/pull/56/files#diff-74b306f15b4564a89129b55e94dc6606R16 and other places? All that it needs its a line break, as described at https://github.com/plataformatec/simple_form/pull/1369#issuecomment-312208316.

Sure, don't complain 鈥撀爈ooking forward to see a PR from you. It's open source. 鉁岋笍

I've added the additional margin-right to perfectly match the bootstrap form if you visually diff them.
You will need some additional styling anyway, since simple_form did not allow customization of .collection_check_boxes and .collection_radio_buttons.

Excuse me, gentlemen, for commenting in a closed topic but I (and I believe many other users) will find this situation highly confusing. What is the best course of action here? I use Bootstrap 4 in my app. This will not change. Can I use just helper methods from simple_form (e.g. simple_form_for) to leverage simplified field generation but wrap the generated code in my manually written Bootstrap 4 code in views - that means no initializers?

Sorry for asking probably an obvious question but I do not see any straightforward answer. Thank you.

@tordans For me, the issue (Add generator for Bootstrap 4) was resolved so we can keep it closed.

I agree with you, we have some work to do about Bootstrap and I include the Foundation as well. IMHO we can remove the initializers and definitely remove the support for it, but I want to see other opinions about it. I will open another issue explaining the motivations and we can discuss it there.

@technodrome You can use Simple Form with Bootstrap 4 but some things maybe will not work, we are working on it - making Simple Form flexible enough to work with any CSS framework. When we talk about don't support Bootstrap anymore, we are talking about Simple Form generating the configuration out-of-the-box.

Was this page helpful?
0 / 5 - 0 ratings