Remove jQuery dependency

- Resolves #39
This commit is contained in:
Jonathan Abbett 2021-04-15 15:34:23 -04:00
parent eff726c6f4
commit 053093e660
3 changed files with 8 additions and 12 deletions

View File

@ -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() });
});

View File

@ -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 %>',

View File

@ -2,7 +2,6 @@
"name": "abraham",
"private": true,
"dependencies": {
"jquery": "^3.4.0",
"js-cookie": "^2.2.0",
"shepherd.js": "^6.0.0-beta"
}