pallets-eco / flask-admin

Simple and extensible administrative interface framework for Flask
BSD 3-Clause "New" or "Revised" License
5.69k stars 1.56k forks source link

Bootstrap 5 #2163

Open mo8it opened 2 years ago

mo8it commented 2 years ago

Bootstrap 4 is not optimal in flask-admin. The Bootstrap 3 support is better. Maybe just drop Bootstrap 4 and start with Bootstrap 5 which has been released months ago? Thanks for the awesome package!

zloyded commented 2 years ago

+

dagostinelli commented 2 years ago

Not sure about the "not optimal" bit. But an upgrade to BootStrap 5 would be appreciated.

mo8it commented 2 years ago

Not sure about the "not optimal" bit. But an upgrade to BootStrap 5 would be appreciated.

I did mean bugs like this which I did finally manage to fix: https://github.com/flask-admin/flask-admin/pull/2233

ealtamir commented 2 years ago

Anyone knows how hard would it be to override flask-admin templates and use Bootstrap 5?

zloyded commented 1 year ago

somebody?

dagostinelli commented 1 year ago

@ealtamir It doesn't look that hard. Give it a whirl.

mo8it commented 1 year ago

@mrjoes would you merge a done PR to Bootstrap 5? I am not trying to put any pressure, thank you anyway. Just to not waste time ;)

macnewbold commented 1 year ago

Following also. We also would be interested in Bootstrap 5.

samialfattani commented 1 year ago

BootStrap 5 supports LTR (Left-To-Right) direction for RTL languages such as Arabic, Hebrew...etc. BootStrap 5 would be much appreciated.

mariofix commented 1 year ago

Any one want to collaborate on making this happen? I've started playing with the bootswatch update to bootstrap 5.2.3

Soham7777777 commented 3 months ago

This Flask-Admin project is so much useful, Can anyone please guide how to add support for bootstrap-5.3.3 it would be cool!

macnewbold commented 3 months ago

I think the approaches I'd suggest would be either of these two:

  1. Take the bootstrap3 or bootstrap4 example, and modernize it to work with the bootstrap5 changes, and take advantage of some of the new things it offers.
  2. Start without any styling at all, and implement bootstrap5 on it, looking at the bootstrap3/4 plugs for inspiration if you get stuck.

I think either could work well, but I'm sure everyone will have their opinion or preference on which would work better or be easier. I've been bugged by the same thing, and wouldn't mind contributing or helping to test on a work project.

mariofix commented 3 months ago

It's not as easy as it sounds, I have about 60% advanced (I don't use inlines so I haven't got around that), but the main problem is that support for BS4 is not complete, so upgrading it to bs5 is a bit difficult.

macnewbold commented 3 months ago

Indeed. If there's a branch I could help test for you, or contribute to, I'd be happy to do so. I'm hoping we can get a new release out, since there's an important (to me) bugfix in master that isn't released yet, and this would be a great one to have released soon. It's been three years since Bootstrap 5 came out, and v4 is now six years old, and v3 is ten years old. It's time and I think we can get this working now.

mariofix commented 3 months ago

Indeed. If there's a branch I could help test for you, or contribute to, I'd be happy to do so. I'm hoping we can get a new release out, since there's an important (to me) bugfix in master that isn't released yet, and this would be a great one to have released soon. It's been three years since Bootstrap 5 came out, and v4 is now six years old, and v3 is ten years old. It's time and I think we can get this working now.

2350

hasansezertasan commented 2 months ago

Anyone knows how hard would it be to override flask-admin templates and use Bootstrap 5?

I don't think it's too hard. Check out these projects:

hasansezertasan commented 2 months ago

It's not as easy as it sounds, I have about 60% advanced (I don't use inlines so I haven't got around that), but the main problem is that support for BS4 is not complete, so upgrading it to bs5 is a bit difficult.

X-editable has some problems with BS5, so I used a fork.

Also, what do you mean by "support for BS4 is not complete"? It seems OK to me, what's missing?

mariofix commented 4 weeks ago

Anyone knows how hard would it be to override flask-admin templates and use Bootstrap 5?

I don't think it's too hard. Check out these projects:

I didn't know about this one, i'll check it out.

I contribute to this project and because it was impossible to upgrade there, I decided to include it as a PR here :) i guess i'm back there

hasansezertasan commented 3 weeks ago

I contribute to this project and because it was impossible to upgrade there, I decided to include it as a PR here :) i guess i'm back there

Why was it impossible to upgrade there? 🤓

mariofix commented 3 weeks ago

https://github.com/flask-admin/flask-admin/blob/14e24c970f0ee3a29add830612eee9a0b0ba5dcc/flask_admin/base.py#L495C13-L497C89

            :param template_mode:
                Base template path. Defaults to `bootstrap2`. If you want to use
                Bootstrap 3 or 4 integration, change it to `bootstrap3` or `bootstrap4`.

At first i just tried to put None or bs5 but a folder with the name is needed. This parameter loads the base javascript and styles to work with bootswatch, if I just ignore it and make the template regardless, i still get those javascript and styles, with the bugs and fixes for that specific version of bootstrap.

I'm not an expert in front-end, so if there is another workaround it and try to make it work with both javascript loaded (bootstrap 4 and 5), i'll take it, i guess eventually the team here will make their own upgrade.

hasansezertasan commented 3 weeks ago

At first i just tried to put None or bs5 but a folder with the name is needed. This parameter loads the base javascript and styles to work with bootswatch, if I just ignore it and make the template regardless, i still get those javascript and styles, with the bugs and fixes for that specific version of bootstrap.

Hmm. I use template_mode="boostrap4" because it is irrelevant if you override the templates. On the other hand, you are supposed to add the Bootstrap5 Bootswatch files right?

I'm not an expert in front-end, so if there is another workaround it and try to make it work with both javascript loaded (bootstrap 4 and 5), i'll take it, i guess eventually the team here will make their own upgrade.

Why not just override the <script> and <link> tags?