Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Override render to replace the entire body given the option of turbolinks => true #20
This was referenced
May 10, 2017
Having problems with this in that
Pulling PR for now.
In my app I have instead added this to application_controller.rb
Example call from a controller:
The solution is a little tricker than just using
My solution still needs some polishing but it is already working properly on Chrome, Firefox, IE>=8 and PhantomJS (for tests).
I have a really simple CoffeeScript class that handles form submission nicely. Keep in mind that this is used with the new version of turbolinks that does not require jQuery. Redirects if successful, and renders and replaces entire page if not. It uses Turbolinks internal classes to do the rendering so all things work as expected like running scripts, and all data-turbolinks options. It also does a great job of handling the browser history. Hope this helps someone!
in controllers that do the redirect you will want to tell turbolinks to advance the history rather than replace it:
Hi @jondavidchristopher, that is a cool solution.
One downside though is that your controller must be turbolinks-aware when there are redirects (this could be fixed). And also, for me specifically, I need a solution that works with forms displayed on dialogs too, where only the dialog content is replaced. I solved this issues in turbolinks-form.