5

I am using Turbolinks 5 and there is this nice loading bar at the top that shows up for turbolinks-activated links.

It it possible to trigger manually/programmatically the display/progress of this bar for custom AJAX calls (maybe even any AJAX call ?)

I am targeting specifically the submit of remote forms (AJAX) for POST/GET requests. I know about turboforms, which I also sometimes use, but in some cases I expect a more clever JS response from the server, that only generates/reloads part of the page, and I would still like to use Turbolinks' AJAX feedback.

Cyril Duchon-Doris
  • 12,964
  • 9
  • 77
  • 164
  • 1
    although the question is very old, did you found any solution. – roarfromror Mar 06 '20 at 12:17
  • Sorry we've stopped using using turbolinks, and we switched our website to a Rails API + a dedicated Frontend to have more control. Turbolinks provide some out-of-the-box SPA-like functionalities, but it became too limited, too hard to maintain, and we had too many bugs that became hard to solve because we were twisting it in ways we were not supposed to. Be careful with it. – Cyril Duchon-Doris Dec 24 '20 at 10:52

1 Answers1

1

Based on the list of turbolink events, it seems possible to display the bar by emitting a turbolinks:click event.

It also seems possible to call the progressbar class it self.

I hope this at least helps you get on the right path.

Happy coding

ekampp
  • 1,904
  • 18
  • 31
  • "it seems possible to display the bar by emitting a turbolinks:click event" can you please guide with sample code for this statement. – roarfromror Mar 06 '20 at 12:16
  • @roarfromror, you can read more about how to trigger events here: https://stackoverflow.com/questions/2490825/how-to-trigger-event-in-javascript – ekampp Mar 06 '20 at 12:22