django-bootstrap4 icon indicating copy to clipboard operation
django-bootstrap4 copied to clipboard

Make javascript optional

Open xi opened this issue 7 years ago • 4 comments

I am using only the CSS parts of bootstrap, not the JavaScript. Currently, this does not seem to be supported.

The issue I noticed is that the form errors have a close button that requires javascript. I am not sure if there is more.

I would be available to help implementing this. However, I am not sure how to approach the topic and if it is even wanted.

xi avatar Jun 13 '18 07:06 xi

We have a solution for not loading JavaScript, which is do not use the template tag to load JS in your templates.

You have a point with the form errors, but we should look for a different solution there. Adding a global use_javascript settings is not the way we want to go.

dyve avatar Aug 22 '18 09:08 dyve

Thanks for the feedback. I see two possible solutions:

  • Add the dismissable parameter that is available on bootstrap_alert to more template tags, e.g. form_errors and form.
  • Tell people to overwrite form_errors.html and messages.html in their projects.

I think I personally prefer the second option. Not using javascript is a global property and you should not have to add a parameter to every form.

Still, I implemented the first option in a branch.

What do you think should be the way forward?

xi avatar Aug 22 '18 12:08 xi

If we start with the decision that it should be possible to use django-bootstrap4 without using any JavaScript, the next question is how to best implement this.

Up until now, it used to be: just do not include the JavaScript (either through template or manually). But this ticket shows that we also include JS-specific code in the templates.

dyve avatar Aug 26 '18 05:08 dyve

If there is no interest in discussing this any further, I think we should close this issue.

dyve avatar Aug 09 '19 09:08 dyve