diff --git a/app/assets/javascripts/abraham/index.js b/app/assets/javascripts/abraham/index.js index 8f6e410..b93957b 100644 --- a/app/assets/javascripts/abraham/index.js +++ b/app/assets/javascripts/abraham/index.js @@ -1,8 +1,7 @@ -//= require jquery //= require js-cookie/src/js.cookie //= require shepherd.js/dist/js/shepherd -$(document).on('turbolinks:before-cache', function() { - // Remove visible product tours - $(".shepherd-step").remove(); +document.addEventListener('turbolinks:before-cache', function() { + // Remove visible product tours + document.querySelectorAll(".shepherd-element").forEach(function(el) { el.remove() }); }); diff --git a/app/views/application/_abraham.html.erb b/app/views/application/_abraham.html.erb index 084124c..1053e69 100644 --- a/app/views/application/_abraham.html.erb +++ b/app/views/application/_abraham.html.erb @@ -2,13 +2,11 @@ var tour = new Shepherd.Tour(<%= Rails.configuration.abraham.tour_options.html_safe unless Rails.configuration.abraham.tour_options.nil? %>); tour.on("complete", function() { - // ajax - return $.ajax({ - url: "/abraham_histories/", - type: "POST", - dataType: "json", - contentType: "application/json", - data: JSON.stringify({ + // Make AJAX call to save history of tour completion + return fetch("/abraham_histories/", { + method: "POST", + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ authenticity_token: '<%= form_authenticity_token %>', controller_name: '<%= controller_name %>', action_name: '<%= action_name %>', diff --git a/package.json b/package.json index dac4adb..7b3f2b4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "abraham", "private": true, "dependencies": { - "jquery": "^3.4.0", "js-cookie": "^2.2.0", "shepherd.js": "^6.0.0-beta" }