From: Radek Czajka Date: Fri, 23 Jun 2023 12:04:08 +0000 (+0200) Subject: Layout fixes, cover update for files. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/a9226097c8eea0591fd3249f62a71becc6d2be93 Layout fixes, cover update for files. --- diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 5acb58ea5..3538f3072 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -39,7 +39,7 @@ mutagen==1.45.1 sorl-thumbnail==12.8.0 # home-brewed & dependencies -librarian==2.5.1 +librarian==2.6 # celery tasks celery[redis]==5.2.7 diff --git a/src/catalogue/templates/catalogue/2022/fragment_box.html b/src/catalogue/templates/catalogue/2022/fragment_box.html index 01bb680e4..b6be44f13 100644 --- a/src/catalogue/templates/catalogue/2022/fragment_box.html +++ b/src/catalogue/templates/catalogue/2022/fragment_box.html @@ -12,7 +12,7 @@ {% endif %} -
+

{% for author in fragment.book.authors %} {{ author }}{% if not forloop.last %}, {% endif %} diff --git a/src/catalogue/templates/catalogue/2022/themed_book_list.html b/src/catalogue/templates/catalogue/2022/themed_book_list.html index 48053bc79..785f1c76e 100644 --- a/src/catalogue/templates/catalogue/2022/themed_book_list.html +++ b/src/catalogue/templates/catalogue/2022/themed_book_list.html @@ -43,9 +43,9 @@

{% nice_title_from_tags tags categories %}

- {% if suggest %} + {% if suggested_tags %}
- {% for tag in suggest %} + {% for tag in suggested_tags %} {{ tag }} diff --git a/src/catalogue/templates/catalogue/recent_audiobooks_list.html b/src/catalogue/templates/catalogue/recent_audiobooks_list.html index b600936f8..14ac34273 100644 --- a/src/catalogue/templates/catalogue/recent_audiobooks_list.html +++ b/src/catalogue/templates/catalogue/recent_audiobooks_list.html @@ -1,25 +1,23 @@ -{% extends request.EXPERIMENTS.layout|yesno:"2022/base.html,base/base.html" %} +{% extends "2022/base.html" %} {% load i18n %} {% load catalogue_tags %} -{% block titleextra %}{% trans "Recent audiobooks" %}{% endblock %} +{% block settings %} + {% load title %} + {% trans "Recent audiobooks" as title %} + {% title title %} +{% endblock %} -{% block bodyid %}recent-list{% endblock %} +{% block main %} +
+

{% trans "Recent audiobooks" %}

+
-{% block body %}{% block main %} -

{% trans "Recent audiobooks" %}

- - {% if request.EXPERIMENTS.layout %} -
-
- {% for book in object_list %} - {% include "catalogue/2022/book_box.html" %} - {% endfor %} -
-
- {% else %} -
- {% work_list object_list %} +
+
+ {% for book in object_list %} + {% include "catalogue/2022/book_box.html" %} + {% endfor %}
- {% endif %} -{% endblock %}{% endblock %} +
+{% endblock %} diff --git a/src/catalogue/templates/catalogue/recent_daisy_list.html b/src/catalogue/templates/catalogue/recent_daisy_list.html index fe6be3bb1..e4f6f69a2 100644 --- a/src/catalogue/templates/catalogue/recent_daisy_list.html +++ b/src/catalogue/templates/catalogue/recent_daisy_list.html @@ -1,25 +1,24 @@ -{% extends request.EXPERIMENTS.layout|yesno:"2022/base.html,base/base.html" %} +{% extends "2022/base.html" %} {% load i18n %} {% load catalogue_tags %} -{% block titleextra %}{% trans "Recent DAISY files" %}{% endblock %} +{% block settings %} + {% load title %} + {% trans "Recent DAISY files" as title %} + {% title title %} +{% endblock %} -{% block bodyid %}recent-list{% endblock %} -{% block body %}{% block main %} -

{% trans "Recent DAISY files" %}

+{% block main %} +
+

{% trans "Recent DAISY files" %}

+
- {% if request.EXPERIMENTS.layout %} -
-
- {% for book in object_list %} - {% include "catalogue/2022/book_box.html" %} - {% endfor %} -
+
+
+ {% for book in object_list %} + {% include "catalogue/2022/book_box.html" %} + {% endfor %}
- {% else %} -
- {% work_list object_list %} -
- {% endif %} -{% endblock %}{% endblock %} +
+{% endblock %} diff --git a/src/catalogue/templates/catalogue/recent_list.html b/src/catalogue/templates/catalogue/recent_list.html index f6b917228..70a5f5c5a 100644 --- a/src/catalogue/templates/catalogue/recent_list.html +++ b/src/catalogue/templates/catalogue/recent_list.html @@ -1,32 +1,32 @@ -{% extends request.EXPERIMENTS.layout|yesno:"2022/base.html,base/base.html" %} +{% extends "2022/base.html" %} {% load i18n %} {% load catalogue_tags %} -{% block titleextra %}{% trans "Recent publications" %}{% endblock %} +{% block settings %} + {% load title %} + {% trans "Recent publications" as title %} + {% title title %} +{% endblock %} -{% block bodyid %}recent-list{% endblock %} - -{% block body %}{% block main %} -

{% trans "Recent publications" %}

+{% block main %} +
+

{% trans "Recent publications" %}

+
{% url 'recent_audiobooks_list' as a %} {% url 'recent_daisy_list' as d %} -

+

+

{% blocktrans %}You can also see recent audiobooks and recent DAISY files.{% endblocktrans %}

+
- {% if request.EXPERIMENTS.layout %} -
-
- {% for book in object_list %} - {% include "catalogue/2022/book_box.html" %} - {% endfor %} -
-
- {% else %} -
- {% work_list object_list %} +
+
+ {% for book in object_list %} + {% include "catalogue/2022/book_box.html" %} + {% endfor %}
- {% endif %} -{% endblock %}{% endblock %} +
+{% endblock %} diff --git a/src/catalogue/views.py b/src/catalogue/views.py index 95298897c..d93ae3553 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -202,15 +202,13 @@ class BookList(ObjectListView): def search(self, qs): term = self.request.GET.get('search') if term: - meta_rels = TagRelation.objects.exclude(tag__category='set') + meta_rels = TagRelation.objects.filter(tag__category='author') # TODO: search tags in currently displaying language if self.is_themed: - #qs = qs.annotate( - # meta=FilteredRelation('book__tag_relations', condition=Q(tag_relations__in=meta_rels)) - #) + rels = meta_rels.filter(tag__name_pl__icontains=term) qs = qs.filter( Q(book__title__icontains=term) | - #Q(meta__tag_relations__tag__name_pl__icontains=term) | + Q(tag_relations__in=rels) | Q(text__icontains=term) ).distinct() else: @@ -294,8 +292,26 @@ class TaggedObjectList(BookList): def get_suggested_tags(self, queryset): tag_ids = [t.id for t in self.ctx['tags']] - related_tags = list(get_top_level_related_tags(self.ctx['tags'])) - if not self.is_themed: + if self.is_themed: + related_tags = [] + current_books = self.get_queryset().values_list('book', flat=True).distinct() + containing_books = Book.objects.filter(Q(id__in=current_books) | Q(children__in=current_books)) + + related_tags.extend(list( + Tag.objects.usage_for_queryset( + containing_books, + ).exclude(category='set').exclude(pk__in=tag_ids) + )) + if self.request.user.is_authenticated: + related_tags.extend(list( + Tag.objects.usage_for_queryset( + containing_books + ).filter( + user=self.request.user + ).exclude(name='').exclude(pk__in=tag_ids) + )) + else: + related_tags = list(get_top_level_related_tags(self.ctx['tags'])) if self.request.user.is_authenticated: qs = Book.tagged.with_all(self.ctx['tags']).filter(findable=True) related_tags.extend(list( diff --git a/src/waiter/templates/waiter/wait.html b/src/waiter/templates/waiter/wait.html index c004895e1..b67d957f6 100644 --- a/src/waiter/templates/waiter/wait.html +++ b/src/waiter/templates/waiter/wait.html @@ -1,25 +1,22 @@ -{% extends request.EXPERIMENTS.layout.value|yesno:"2022/base_simple.html,base/base.html" %} +{% extends "2022/base_simple.html" %} {% load i18n %} {% load static from static %} {% block settings %} {% load title %} - {% trans "Your file is being prepared, please wait." as title %} - {% title title %} -{% endblock %} - -{% block titleextra %} {% if file_url %} - {% trans "The file is ready for download!" %} + {% trans "The file is ready for download!" as title %} {% else %} {% if waiting %} - {% trans "Your file is being prepared, please wait." %} + {% trans "Your file is being prepared, please wait." as title %} {% else %} - {% trans "Something went wrong." %} + {% trans "Something went wrong." as title %} {% endif %} {% endif %} + + {% title title %} {% endblock %} diff --git a/src/wolnelektury/settings/contrib.py b/src/wolnelektury/settings/contrib.py index 664003ff1..d410ddd89 100644 --- a/src/wolnelektury/settings/contrib.py +++ b/src/wolnelektury/settings/contrib.py @@ -51,7 +51,6 @@ FORMS_BUILDER_EXTRA_FIELDS = [ (100, 'contact.fields.HeaderField', 'Header'), (101, 'contact.fields.SeparatorField', 'Separator'), ] -FORMS_BUILDER_HELPTEXT_MAX_LENGTH = 2048 FORMS_BUILDER_REQUIRED_CSS_CLASS = 'required' FORMS_BUILDER_INACTIVE_VISIBLE = True FORMS_BUILDER_TEMPLATE_NAME_P = 'forms/p.html'