Skip to content

Commit

Permalink
Migrate Rails Guides from Turbolinks to Turbo
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoroth committed Oct 17, 2022
1 parent d1aa6af commit 0f6575a
Show file tree
Hide file tree
Showing 9 changed files with 3,886 additions and 36 deletions.
1 change: 1 addition & 0 deletions codespell.txt
Expand Up @@ -21,6 +21,7 @@ nd
ned
noone
objekt
optin
ot
overthere
reenable
Expand Down
2 changes: 1 addition & 1 deletion guides/assets/javascripts/.gitattributes
@@ -1,2 +1,2 @@
clipboard.js linguist-vendored
turbolinks.js linguist-vendored
turbo.js linguist-vendored
11 changes: 2 additions & 9 deletions guides/assets/javascripts/guides.js
Expand Up @@ -23,10 +23,7 @@
for(var i = 0; i < array.length; i++) callback(array[i]);
}

// Viewable on local
if (window.location.protocol === "file:") Turbolinks.supported = false;

document.addEventListener("turbolinks:load", function() {
document.addEventListener("turbo:load", function() {
var guidesMenu = document.getElementById("guidesMenu");
var guides = document.getElementById("guides");

Expand All @@ -52,11 +49,7 @@
guidesIndexItem.value = currentGuidePath.substring(currentGuidePath.lastIndexOf("/") + 1) || 'index.html';

guidesIndexItem.addEventListener("change", function(e) {
if (Turbolinks.supported) {
Turbolinks.visit(e.target.value);
} else {
window.location = e.target.value;
}
Turbo.visit(e.target.value);
});

var moreInfoButton = document.querySelector(".more-info-button");
Expand Down

0 comments on commit 0f6575a

Please sign in to comment.