mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-02 13:28:43 +00:00
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:
parent
fbf7f37664
commit
7fbc9914de
2 changed files with 17 additions and 11 deletions
|
@ -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();
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue