Better Turbo support documentation? #8573
Replies: 3 comments 2 replies
-
Thanks for this! It is enough to just IMO this should be handled by AA internally as it's currently not working with a default Rails app (that uses turbo). Also, otherwise, the user needs to take care to sync the flowbite version with whatever AA is using in the background. |
Beta Was this translation helpful? Give feedback.
-
It is working with a default rails app because main |
Beta Was this translation helpful? Give feedback.
-
There's a newer discussion thread here: #8694 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been trying to add Turbo to ActiveAdmin v4 and it took me a while to get it working. I got it working through this Stackoverflow comment that I first found linked here on GitHub discussions:
It's the very last comment, kinda hidden in the sea of other comments. Perhaps this should be written somewhere in the docs? What do you think? Should we add this to the docs? If so, where?
Another thing is that I realized that now that I have Turbo and it's used to navigate between pages by default, when I navigate to a new page, the Flowbite JavaScript isn't reinitialized and it doesn't hook up to data attributes and it doesn't work.
The good news is that Flowbite provides support for Turbo:
https://flowbite.com/docs/getting-started/rails/
https://flowbite.com/docs/getting-started/rails/#turbo-load-support
...but it's a different exported JavaScript file. From what I can see, when using Flowbite Turbo JavaScript version, which only has some smaller changes, it doesn't work without the Turbo, so it doesn't work for ActiveAdmin initial setup. Although, we could probably replace
import "flowbite"
with:...or something similar.
Otherwise, we could write in the docs that, if you want to use Turbo with ActiveAdmin, you should use Flowbite Turbo and then it should work. What do you think?
I made the ActiveAdmin and Turbo (and Flowbite) work together nicely by following the Stackoverflow steps from here:
https://stackoverflow.com/a/78985377
...and adding this to my
config/importmap.rb
:pin "flowbite", to: "https://cdn.jsdelivr.net/npm/flowbite@2.5.2/dist/flowbite.turbo.min.js"
Beta Was this translation helpful? Give feedback.
All reactions