parent
eff726c6f4
commit
ce283c28fd
@ -1,8 +1,7 @@
|
|||||||
//= require jquery
|
|
||||||
//= require js-cookie/src/js.cookie
|
//= require js-cookie/src/js.cookie
|
||||||
//= require shepherd.js/dist/js/shepherd
|
//= require shepherd.js/dist/js/shepherd
|
||||||
|
|
||||||
$(document).on('turbolinks:before-cache', function() {
|
document.addEventListener('turbolinks:before-cache', function() {
|
||||||
// Remove visible product tours
|
// Remove visible product tours
|
||||||
$(".shepherd-step").remove();
|
document.querySelectorAll(".shepherd-element").forEach(function(el) { el.remove() });
|
||||||
});
|
});
|
||||||
|
@ -2,13 +2,11 @@
|
|||||||
var tour = new Shepherd.Tour(<%= Rails.configuration.abraham.tour_options.html_safe unless Rails.configuration.abraham.tour_options.nil? %>);
|
var tour = new Shepherd.Tour(<%= Rails.configuration.abraham.tour_options.html_safe unless Rails.configuration.abraham.tour_options.nil? %>);
|
||||||
|
|
||||||
tour.on("complete", function() {
|
tour.on("complete", function() {
|
||||||
// ajax
|
// Make AJAX call to save history of tour completion
|
||||||
return $.ajax({
|
return fetch("/abraham_histories/", {
|
||||||
url: "/abraham_histories/",
|
method: "POST",
|
||||||
type: "POST",
|
headers: { 'Content-Type': 'application/json' },
|
||||||
dataType: "json",
|
body: JSON.stringify({
|
||||||
contentType: "application/json",
|
|
||||||
data: JSON.stringify({
|
|
||||||
authenticity_token: '<%= form_authenticity_token %>',
|
authenticity_token: '<%= form_authenticity_token %>',
|
||||||
controller_name: '<%= controller_name %>',
|
controller_name: '<%= controller_name %>',
|
||||||
action_name: '<%= action_name %>',
|
action_name: '<%= action_name %>',
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
"name": "abraham",
|
"name": "abraham",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jquery": "^3.4.0",
|
|
||||||
"js-cookie": "^2.2.0",
|
"js-cookie": "^2.2.0",
|
||||||
"shepherd.js": "^6.0.0-beta"
|
"shepherd.js": "^6.0.0-beta"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user