change cancel buttons for guided tour

The first pop up in the guided tour on each page should provide a button to switch off the guided tour altogether, not simply cancel the current iteration.
If we don't do this, then the only way to turn off the guided tour is to go right to the end, which could be really irritating, especially for people who star the tour and then start exploring on their own.
This commit is contained in:
Hugh Rundle 2022-06-13 20:25:42 +10:00
parent fbf7f37664
commit 7fbc9914de
2 changed files with 17 additions and 11 deletions

View file

@ -4,7 +4,7 @@
<script>
const csrftoken = document.querySelector('[name=csrfmiddlewaretoken]').value;
function disableTour() {
fetch('guided-tour/False', {
fetch('/guided-tour/False', {
headers: {
'X-CSRFToken': csrftoken,
},
@ -76,14 +76,6 @@
on: "bottom",
},
buttons: [
{
action() {
return this.cancel();
},
secondary: true,
text: "{% trans 'Cancel' %}",
classes: "is-danger",
},
{
action() {
return this.next();

View file

@ -1,6 +1,19 @@
{% load i18n %}
{% csrf_token %}
<script>
const csrftoken = document.querySelector('[name=csrfmiddlewaretoken]').value;
function disableTour() {
fetch('/guided-tour/False', {
headers: {
'X-CSRFToken': csrftoken,
},
method: 'POST',
redirect: 'follow',
mode: 'same-origin',
})
.then( resp => {console.log(resp.statusText) })
}
const tour = new Shepherd.Tour({
exitOnEsc: true,
});
@ -12,10 +25,11 @@
buttons: [
{
action() {
return this.cancel();
disableTour();
return this.complete();
},
secondary: true,
text: "{% trans 'Cancel' %}",
text: "{% trans 'End Tour' %}",
classes: "is-danger",
},
{