From 4dad587dac33c6c04d9a1a594fbbd1c58dbf2bda Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 22 Apr 2022 15:31:47 +0200 Subject: [PATCH] Fixes --- src/catalogue/models/book.py | 13 +++++++------ src/catalogue/templates/catalogue/book_text.html | 2 +- src/wolnelektury/static/2021/scripts/main.js | 10 +++++++++- .../static/2022/styles/components/_player.scss | 6 ++++++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index 2371103e7..ea4debde9 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -296,23 +296,24 @@ class Book(models.Model): return self.parent.get_prev_text() - def get_next_text(self): - child = self.children.order_by('parent_number').first() - if child is not None: - return child.get_first_text() + def get_next_text(self, inside=True): + if inside: + child = self.children.order_by('parent_number').first() + if child is not None: + return child.get_first_text() if not self.parent: return None sibling = self.parent.children.filter(parent_number__gt=self.parent_number).order_by('parent_number').first() if sibling is not None: return sibling.get_first_text() - return self.parent.get_next_text() + return self.parent.get_next_text(inside=False) def get_child_audiobook(self): BookMedia = apps.get_model('catalogue', 'BookMedia') if not BookMedia.objects.filter(book__ancestor=self).exists(): return None - for child in self.children.all(): + for child in self.children.order_by('parent_number').all(): if child.has_mp3_file(): return child child_sub = child.get_child_audiobook() diff --git a/src/catalogue/templates/catalogue/book_text.html b/src/catalogue/templates/catalogue/book_text.html index 158396fe9..9d28bd7bc 100644 --- a/src/catalogue/templates/catalogue/book_text.html +++ b/src/catalogue/templates/catalogue/book_text.html @@ -114,7 +114,7 @@ {% block footer %}
{% if book.parent %} - {% for b in book.ancestor.all %} + {% for b in book.ancestors %} {% if forloop.counter > 1 %}
  • {% endif %} diff --git a/src/wolnelektury/static/2021/scripts/main.js b/src/wolnelektury/static/2021/scripts/main.js index 68708377d..4d177715c 100644 --- a/src/wolnelektury/static/2021/scripts/main.js +++ b/src/wolnelektury/static/2021/scripts/main.js @@ -28,7 +28,7 @@ }); })(); -// Ebook/Audiobook Btns +/// Ebook/Audiobook Btns (function() { let button = $('.c-media__btn button:not(.l-button--media--full)'); let popupLayer = $('.c-media__popup'); @@ -138,6 +138,14 @@ } if($change.length) { change(); } + + + function quit_experiment() { + document.cookie = 'EXPERIMENT_layout=off; path=/; max-age=31536000'; + window.location.reload(true); + } + $(".quit-experiment").click(quit_experiment); + })(); //Switch diff --git a/src/wolnelektury/static/2022/styles/components/_player.scss b/src/wolnelektury/static/2022/styles/components/_player.scss index 6adafd73c..2589d9c0c 100644 --- a/src/wolnelektury/static/2022/styles/components/_player.scss +++ b/src/wolnelektury/static/2022/styles/components/_player.scss @@ -307,3 +307,9 @@ } } } + + +.project-icon { + max-width: 100px; + max-height: 50px; +} -- 2.20.1