From: Radek Czajka Date: Wed, 31 Jan 2024 07:54:46 +0000 (+0100) Subject: sponsor alt X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/a0f904af83bea5306b09fd66d8dfa254761f5a07?ds=sidebyside;hp=8885fd14f5f040eb3aa69f1d705856f99a1fa572 sponsor alt --- diff --git a/src/catalogue/forms.py b/src/catalogue/forms.py index 055800edc..919ff3a62 100644 --- a/src/catalogue/forms.py +++ b/src/catalogue/forms.py @@ -19,6 +19,7 @@ class BookImportForm(forms.Form): hidden = forms.BooleanField(required=False) logo = forms.CharField(required=False) logo_mono = forms.CharField(required=False) + logo_alt = forms.CharField(required=False) def clean(self): from django.core.files.base import ContentFile @@ -38,6 +39,7 @@ class BookImportForm(forms.Form): findable=not self.cleaned_data['hidden'], logo=self.cleaned_data['logo'], logo_mono=self.cleaned_data['logo_mono'], + logo_alt=self.cleaned_data['logo_alt'], **kwargs) diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index b14269f8d..b2d960b67 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -594,7 +594,7 @@ class Book(models.Model): @classmethod def from_text_and_meta(cls, raw_file, book_info, overwrite=False, dont_build=None, search_index=True, - remote_gallery_url=None, days=0, findable=True, logo=None, logo_mono=None): + remote_gallery_url=None, days=0, findable=True, logo=None, logo_mono=None, logo_alt=None): from catalogue import tasks if dont_build is None: @@ -646,6 +646,8 @@ class Book(models.Model): extra['logo'] = logo if logo_mono: extra['logo_mono'] = logo_mono + if logo_alt: + extra['logo_alt'] = logo_alt book.extra_info = json.dumps(extra) book.load_abstract() book.load_toc() diff --git a/src/catalogue/templates/catalogue/book_info.html b/src/catalogue/templates/catalogue/book_info.html index 424d75980..838b59fb0 100644 --- a/src/catalogue/templates/catalogue/book_info.html +++ b/src/catalogue/templates/catalogue/book_info.html @@ -42,7 +42,9 @@ {% if extra_info.logo %} {% thumbnail extra_info.logo '300x200' as th %} - + {{ extra_info.logo_alt|default:'Sponsor' }} {% endthumbnail %} {% endif %} diff --git a/src/catalogue/templates/catalogue/book_text.html b/src/catalogue/templates/catalogue/book_text.html index 041a07a28..67372b3dd 100644 --- a/src/catalogue/templates/catalogue/book_text.html +++ b/src/catalogue/templates/catalogue/book_text.html @@ -62,8 +62,10 @@ {% if extra_info.logo_mono %} - {% thumbnail extra_info.logo_mono '200x200' as th %} - + {% thumbnail extra_info.logo_mono '200x200' as th %} + {{ extra_info.logo_alt|default:'Sponsor' }} {% endthumbnail %} {% endif %}