Skip to content
Snippets Groups Projects
Commit 668e8485 authored by xaralis's avatar xaralis Committed by jan.bednarik
Browse files

fix(district): person email shouldn't be mandatory, show person photo...

fix(district): person email shouldn't be mandatory, show person photo placeholder when real photo unavailable
parent 68457cea
No related branches found
No related tags found
2 merge requests!496Release,!491feat(district): rework election page tree from scratch, update to latest styleguide 2.10.0, load styleguide from CDN and more
Pipeline #8039 passed
# Generated by Django 4.0.3 on 2022-05-09 07:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("district", "0069_districtpersonpage_other_party_and_more"),
]
operations = [
migrations.AlterField(
model_name="districtpersonpage",
name="email",
field=models.EmailField(
blank=True, max_length=254, null=True, verbose_name="Email"
),
),
]
......@@ -655,7 +655,7 @@ class DistrictPersonPage(
)
text = RichTextField("text", blank=True, features=RICH_TEXT_DEFAULT_FEATURES)
email = models.EmailField("Email", null=True)
email = models.EmailField("Email", null=True, blank=True)
show_email = models.BooleanField("Zobrazovat email na stránce?", default=True)
phone = models.CharField("Telefon", max_length=16, blank=True, null=True)
city = models.CharField("Město/obec", max_length=64, blank=True, null=True)
......
......@@ -30,8 +30,12 @@
<div class="card__body p-4 lg:p-8">
<div class="text-center mb-8">
<div class="avatar avatar--2xl lg:avatar--3xl avatar--bordered candidate-detail__avatar">
{% if page.profile_photo %}
{% image page.profile_photo fill-416x416 as profile_img %}
<img src="{{ profile_img.url }}" alt="Avatar">
<img src="{{ profile_img.url }}" alt="{{ page.profile_photo }}">
{% else %}
<img src="{% static "shared/img/unknown_pirate_416x416.jpg" %}" alt="{{ person_page.title }}"/>
{% endif%}
</div>
</div>
......
shared/static/shared/img/unknown_pirate_160x160.jpg

5.17 KiB

shared/static/shared/img/unknown_pirate_416x416.jpg

16.7 KiB

Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -7,8 +7,13 @@
</span>
</div>
<div class="avatar avatar--sm candidate-table-row__avatar">
{% image person_page.profile_photo max-80x80 as profile_img %}{# záměrně stejná velikost jako na PersonPage #}
<img src="{{ profile_img.url }}" alt="{{ person_page.title }}">
{% if person_page.profile_photo %}
{# Match sizing of person_badge_snippet.html to keep the image version count low #}
{% image person_page.profile_photo fill-160x160 as profile_img %}
<img src="{{ profile_img.url }}" alt="{{ person_page.title }}"/>
{% else %}
<img src="{% static "shared/img/unknown_pirate_160x160.jpg" %}" alt="{{ person_page.title }}"/>
{% endif %}
</div>
<div class="candidate-table-row__name head-heavy-2xs font-bold">
{{ person_page.title }}
......
......@@ -10,8 +10,13 @@
{{ forloop.counter }}
</div>
<a href="{{ person_page.url }}" class="avatar avatar--sm sm:avatar--lg">
{% image person_page.profile_photo max-208x208 as profile_img %}{# záměrně stejná velikost jako na PersonPage #}
<img src="{{ profile_img.url }}" alt="{{ person_page.title }}">
{% if person_page.profile_photo %}
{# Match sizing of person page to keep the image version count low #}
{% image person_page.profile_photo fill-416x416 as profile_img %}
<img src="{{ profile_img.url }}" alt="{{ person_page.title }}"/>
{% else %}
<img src="{% static "shared/img/unknown_pirate_416x416.jpg" %}" alt="{{ person_page.title }}"/>
{% endif %}
</a>
</div>
<div class="candidate-card__bio">
......@@ -20,7 +25,7 @@
{{ person_page.title }}
</a>
</h1>
{% if person_page.email %}
{% if person_page.email and person_page.show_email %}
<a href="{{ person_page.email }}" class="block candidate-card__bio-item mb-4">
{{ person_page.email }}
</a>
......
{% load wagtailimages_tags %}
{% load static wagtailimages_tags %}
<div class="badge badge--condensed">
<a href="{{ person_page.url }}" class="avatar badge__avatar avatar--sm">
{% image person_page.profile_photo fill-80x80 as profile_img %}
{% if person_page.profile_photo %}
{% image person_page.profile_photo fill-160x160 as profile_img %}
<img src="{{ profile_img.url }}" alt="{{ person_page.title }}"/>
{% else %}
<img src="{% static "shared/img/unknown_pirate_160x160.jpg" %}" alt="{{ person_page.title }}"/>
{% endif%}
</a>
<div class="badge__body">
......@@ -21,13 +25,13 @@
</span>
{% if not skipcontacts %}
{% if person_page.phone %}
<a href="tel:{{ person_page.phone }}"
class="contact-line icon-link content-block--nostyle contact-line--responsive badge__link">
<a href="tel:{{ person_page.phone }}" class="contact-line icon-link content-block--nostyle contact-line--responsive badge__link">
<i class="ico--phone"></i>
<span>{{ person_page.phone }}</span>
</a>
{% endif %}
{% if person_page.email %}
{% if person_page.email and person_page.show_email %}
<a href="mailto:{{ person_page.email }}"
class="contact-line icon-link content-block--nostyle contact-line--responsive badge__link">
<i class="ico--envelope"></i><span>{{ person_page.email }}</span>
......
{% load wagtailimages_tags %}
{% load static wagtailimages_tags %}
<div class="badge w-full">
<div class="avatar avatar--md badge__avatar">
{% image person_page.profile_photo max-100x100 as profile_img %}
{% if person_page.profile_photo %}
{# Match sizing of person page to keep the image version count low #}
{% image person_page.profile_photo fill-416x416 as profile_img %}
<img src="{{ profile_img.url }}" alt="{{ person_page.title }}"/>
{% else %}
<img src="{% static "shared/img/unknown_pirate_416x416.jpg" %}" alt="{{ person_page.title }}"/>
{% endif %}
</div>
<div class="badge__body">
......@@ -23,7 +28,7 @@
<span>{{ person_page.phone }}</span>
</a>
{% endif %}
{% if person_page.email %}
{% if person_page.email and person_page.show_email %}
<a href="mailto:{{ person_page.email }}" class="contact-line contact-line--responsive icon-link badge__link">
<i class="ico--envelope"></i>
<span>{{ person_page.email }}</span>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment