remove CSRF from tour scripts

This commit is contained in:
Hugh Rundle 2022-06-18 17:16:43 +10:00
parent 57965973dc
commit 044a173095
4 changed files with 119 additions and 15 deletions

View file

@ -1,17 +1,4 @@
{% load i18n %}
{% csrf_token %}
<!-- TODO: account for smaller screen view in all tours -->
<!--
order of tour:
1. home page
2. profile
3. books (shelves)
4. lists
5. groups
6. direct messages
7. settings
-->
<script>
const tour = new Shepherd.Tour({

View file

@ -1,5 +1,4 @@
{% load i18n %}
{% csrf_token %}
<script>
const initiateTour = new Shepherd.Tour({

View file

@ -0,0 +1,119 @@
{% load i18n %}
<script>
const tour = new Shepherd.Tour({
exitOnEsc: true,
});
tour.addSteps([
{
text: "{% trans 'ffff' %}",
title: "{% trans 'bbbb' %}",
buttons: [
{
action() {
disableGuidedTour(csrf_token);
return this.complete();
},
secondary: true,
text: "{% trans 'End Tour' %}",
classes: "is-danger",
},
{
action() {
return this.next();
},
text: "{% trans 'Next' %}",
},
],
},
{
text: "{% trans 'These are your book shelves.' %}",
title: "{% trans 'Shelves' %}",
attachTo: {
element: "#user-shelves",
on: "top",
},
buttons: [
{
action() {
return this.back();
},
secondary: true,
text: "{% trans 'Back' %}",
},
{
action() {
return this.next();
},
text: "{% trans 'Next' %}",
},
],
},
{
text: "{% trans 'The BLAH are default shelves that are used to indicate the reading status of books. A book can only be assigned to one of these shelves at any given moment e.g. a book is not allowed to be on both the Currently Reading and the To Read shelves. Usually Bookwyrm will automatically allocate a book to one of these shelves when you change the reading status of the book.' %}",
title: "{% trans 'Creating a group' %}",
attachTo: {
element: "#user-shelves",
on: "bottom-start",
},
buttons: [
{
action() {
return this.back();
},
secondary: true,
text: "{% trans 'Back' %}",
},
{
action() {
return this.next();
},
text: "{% trans 'Next' %}",
},
],
},
{
text: "{% trans 'Groups can be ' %}\
<code>{% trans 'Public' %}</code>,\
<code>{% trans 'Unlisted' %}</code>,\
{% trans 'or ' %}\
<code>{% trans 'Private' %}</code><br><br>\
{% trans 'Anyone can see and join a public group. Unlisted groups are currently exactly the same as public groups. Private groups can only be seen by members of the group.' %}",
title: "{% trans 'Group visibility' %}",
attachTo: {
element: "#privacy_select_button",
on: "left",
},
buttons: [
{
action() {
return this.back();
},
secondary: true,
text: "{% trans 'Back' %}",
},
{
action() {
return this.next();
},
text: "{% trans 'Next' %}",
},
],
},
{
text: "{% trans 'Once you\'re happy with how your group is set up, click the \'Save\' button.' %}",
title: "{% trans 'Save your group' %}",
buttons: [
{
action() {
return this.complete();
},
text: "{% trans 'Ok' %}",
},
],
},
])
tour.start()
</script>

View file

@ -1,5 +1,4 @@
{% load i18n %}
{% csrf_token %}
<script>
const tour = new Shepherd.Tour({