fix bugs + default page cover

This commit is contained in:
bkfox 2020-05-21 13:50:17 +02:00
parent 1003ad315f
commit 1a3e8d7771
3 changed files with 8 additions and 3 deletions

View File

@ -66,6 +66,11 @@ class Station(models.Model):
help_text=_("Audio streams urls used by station's player. One url "
"a line.")
)
default_cover = FilerImageField(
on_delete=models.SET_NULL,
verbose_name=_('Default pages cover'), null=True, blank=True,
related_name='+',
)
objects = StationQuerySet.as_manager()

View File

@ -6,7 +6,7 @@
{% if not parent %}{{ view.model|verbose_name:True|title }}
{% else %}
{% with parent.title as title %}
{% with model|default:"Publications"|verbose_name:true|capfirst as model %}
{% with model|default:"Publications"|verbose_name:True|capfirst as model %}
{% comment %}Translators: title when pages are filtered for a specific parent page, e.g.: Articles of My Incredible Show{% endcomment %}
{% blocktrans %}{{ model }} of {{ title }}{% endblocktrans %}
{% endwith %}

View File

@ -14,7 +14,7 @@ Context variables:
<article class="card {% if is_primary %}is-primary{% endif %}">
<header class="card-image">
<figure class="image is-4by3">
<img src="{% thumbnail object.cover 480x480 %}">
<img src="{% thumbnail object.cover|default:station.default_cover 480x480 %}">
</figure>
</header>
<div class="card-header">
@ -29,7 +29,7 @@ Context variables:
<article class="media item {% if is_primary %}is-primary{% endif %}">
{% if has_cover|default_if_none:True %}
<div class="media-left">
<img src="{% thumbnail object.cover 128x128 crop=scale %}"
<img src="{% thumbnail object.cover|default:station.default_cover 128x128 crop=scale %}"
class="small-cover">
</div>
{% endif %}