bookwyrm/bookwyrm/templates/guided_tour/search.html
Mouse Reeve 868ab62863 Fixes template string quote escapes
It seems totally reasonable that using an escape slash would make
apostrophes in words work, but the translation system works in
mysterious ways that do not include supporting that. I've used backticks
as a third quote type to escape everything in a way that both
javascript and gettext understand.

While I was there I split up some strings that have more complicated
html in them, since that can be fragile when passed through translation,
and confusing for translators.
2022-07-29 11:22:31 -07:00

168 lines
5.4 KiB
HTML

{% load i18n %}
<script>
let localResult = document.querySelector(".local-book-search-result");
let remoteResult = document.querySelector(".remote-book-search-result");
let otherCatalogues = document.querySelector("#tour-load-from-other-catalogues");
let manuallyAdd = document.querySelector("#tour-manually-add-book");
const tour = new Shepherd.Tour({
exitOnEsc: true,
});
if (remoteResult) {
tour.addStep(
{
text: "{% trans 'If the book you are looking for is available on a remote catalogue such as Open Library, click on <strong>Import book</strong>.' %}",
title: "{% trans 'Searching' %}",
attachTo: {
element: "#tour-remote-search-result",
on: "top",
},
buttons: [
{
action() {
disableGuidedTour(csrf_token);
return this.complete();
},
secondary: true,
text: "{% trans 'End Tour' %}",
classes: "is-danger guided-tour-cancel-button",
},
{
action() {
return this.next();
},
text: "{% trans 'Next' %}",
},
],
});
} else if (localResult) {
tour.addStep(
{
text: `{% trans "If the book you are looking for is already on this Bookwyrm instance, you can click on the title to go to the book's page." %}`,
title: "{% trans 'Searching' %}",
attachTo: {
element: "#tour-local-book-search-result",
on: "top",
},
buttons: [
{
action() {
disableGuidedTour(csrf_token);
return this.complete();
},
secondary: true,
text: "{% trans 'End Tour' %}",
classes: "is-danger guided-tour-cancel-button",
},
{
action() {
return this.next();
},
text: "{% trans 'Next' %}",
},
],
});
}
if (otherCatalogues) {
tour.addStep({
text: "{% trans 'If the book you are looking for is not listed, try loading more records from other sources like Open Library or Inventaire.' %}",
title: "{% trans 'Load more records' %}",
attachTo: {
element: "#tour-load-from-other-catalogues",
on: "right",
},
buttons: [
{
action() {
return this.back();
},
secondary: true,
text: "{% trans 'Back' %}",
},
{
action() {
return this.next();
},
text: "{% trans 'Next' %}",
},
],
})
}
if (manuallyAdd) {
tour.addSteps([
{
text: "{% trans 'If your book is not in the results, try adjusting your search terms.' %}",
title: "{% trans 'Search again' %}",
attachTo: {
element: '#tour-search-page-input',
on: "right",
},
buttons: [
{
action() {
return this.back();
},
secondary: true,
text: "{% trans 'Back' %}",
},
{
action() {
return this.next();
},
text: "{% trans 'Next' %}",
},
],
},
{
text: `{% trans "If you still can't find your book, you can add a record manually." %}`,
title: "{% trans 'Add a record manally' %}",
attachTo: {
element: "#tour-manually-add-book",
on: "right",
},
scrollTo: true,
buttons: [
{
action() {
return this.back();
},
secondary: true,
text: "{% trans 'Back' %}",
},
{
action() {
return this.next();
},
text: "{% trans 'Next' %}",
},
],
}])
}
tour.addStep({
text: '<p class="notification is-warning is-light mt-3">{% trans "Import, manually add, or view an existing book to continue the tour." %}<p>',
title: "{% trans 'Continue the tour' %}",
buttons: [
{
action() {
return this.back();
},
secondary: true,
text: "{% trans 'Back' %}",
},
{
action() {
return this.next();
},
text: "{% trans 'Ok' %}",
},
],
})
tour.start()
</script>