Ask A Question

Notifications

You’re not receiving notifications from this thread.

medium/gorails like loading progress at the top of the page

Sean M asked in Javascript

Chris,

What turbolinks compatible solution (gem or anything) would you recommend for implementing loading progress bar for page load?

Thanks,
Szilard

Reply

If you're using Turbolinks 3, it should be on by default. It only shows if the request takes more than a certain period of time I believe, so you may just not be seeing it in development. You might try tossing in a sleep 5 into your code to see if it shows up.

More info on it here: https://github.com/turbolinks/turbolinks-classic#progress-bar

Reply

Chris, thanks for the quick answer. I had some time to read a bit about it, but I just got more confused. Could you answer the following questions?

DHH wrote on the turbolinks-classic page in the first head tag that: "Turbolinks Classic is now deprecated site" which was followed by "Turbolinks 5 is a ground-up rewrite with a new flow, new events, but the same core idea. It's available at turbolinks/turbolinks. This repository remains available for existing applications built on what we now call Turbolinks Classic."

  1. At the moment I'm using version 2.5.3 (latest on rubygems.org). Should I wait for 5.0 and in the meantime use 2.5.3 with "Turbolinks.ProgressBar.enable();" in one of my js files or should I update to 3.0?

  2. If the latter, is there some issues when you upgrade from 2.5.3 to 3.0. I don't know why but I couldn't find a good tutorial to upgrade to 3.0. I found your video on livecoding.tv about gotchas, but couldn't watch it since the video player didn't play it properly :(.

Reply

I think you'll be fine using either one. I've been meaning to upgrade GoRails' Turbolinks to 5.0 but just haven't had the time yet. I'll have to do a screencast on that.

My guess is that 5.0 is okay to use, but they still haven't released some features like the iOS and Android wrappers for it which were the main purpose for 5.0. Feel free to use it though as it should also have a progress bar and will be the version that you'd need to use in the future.

I believe the main change between 2.5 and 3.0 was the addition of the partial replacement stuff. Shouldn't cause any issues when upgrading, but just note that the partial replacement functionality is getting removed in 5.0. They realized that it adds a lot of complexity for very marginal benefit and decided to remove it to keep things simple.

The video on LiveCoding.tv was mostly just exploring the partial replacements in Turbolinks classic, but since that's getting removed, it probably won't be too helpful. It sucks that their player doesn't work! I had trouble with it too and was disappointed with the site.

Reply

Also just found some notes on their recommendation of which version to use: https://github.com/turbolinks/turbolinks#should-i-use-turbolinks-5-or-turbolinks-classic

Reply

Thanks a lot Chris!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.