fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8885fd1
)
sponsor alt
author
Radek Czajka
<rczajka@rczajka.pl>
Wed, 31 Jan 2024 07:54:46 +0000
(08:54 +0100)
committer
Radek Czajka
<rczajka@rczajka.pl>
Wed, 31 Jan 2024 07:54:46 +0000
(08:54 +0100)
src/catalogue/forms.py
patch
|
blob
|
history
src/catalogue/models/book.py
patch
|
blob
|
history
src/catalogue/templates/catalogue/book_info.html
patch
|
blob
|
history
src/catalogue/templates/catalogue/book_text.html
patch
|
blob
|
history
diff --git
a/src/catalogue/forms.py
b/src/catalogue/forms.py
index
055800e
..
919ff3a
100644
(file)
--- 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)
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
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'],
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)
**kwargs)
diff --git
a/src/catalogue/models/book.py
b/src/catalogue/models/book.py
index
b14269f
..
b2d960b
100644
(file)
--- 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,
@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:
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
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()
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
424d759
..
838b59f
100644
(file)
--- 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 %}
{% if extra_info.logo %}
{% thumbnail extra_info.logo '300x200' as th %}
- <img src="{{ th.url }}" style="width: 300px; max-width: 100%;">
+ <img src="{{ th.url }}" style="width: 300px; max-width: 100%;"
+ alt="{{ extra_info.logo_alt|default:'Sponsor' }}"
+ >
{% endthumbnail %}
{% endif %}
{% endthumbnail %}
{% endif %}
diff --git
a/src/catalogue/templates/catalogue/book_text.html
b/src/catalogue/templates/catalogue/book_text.html
index
041a07a
..
67372b3
100644
(file)
--- a/
src/catalogue/templates/catalogue/book_text.html
+++ b/
src/catalogue/templates/catalogue/book_text.html
@@
-62,8
+62,10
@@
</li>
{% if extra_info.logo_mono %}
</li>
{% if extra_info.logo_mono %}
- {% thumbnail extra_info.logo_mono '200x200' as th %}
- <img src="{{ th.url }}" style="width: 100px; padding: 10px;">
+ {% thumbnail extra_info.logo_mono '200x200' as th %}
+ <img src="{{ th.url }}" style="width: 100px; padding: 10px;"
+ alt="{{ extra_info.logo_alt|default:'Sponsor' }}"
+ >
{% endthumbnail %}
{% endif %}
{% endthumbnail %}
{% endif %}