Skip to content
Snippets Groups Projects
Verified Commit 77a692bd authored by jindra12's avatar jindra12
Browse files

Minor fixes for uniweb person page

parent 060da0f8
Branches
No related tags found
2 merge requests!861Release: New homepage design,!839Minor fixes for uniweb person page
Pipeline #15756 passed
# Generated by Django 4.1.8 on 2023-12-09 16:07
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
("uniweb", "0050_uniwebhomepage_donation_page"),
]
operations = [
migrations.AddField(
model_name="uniwebhomepage",
name="fallback_image",
field=models.ForeignKey(
blank=True,
help_text="Tento obrázek bude využit např. jako pozadí pro osobní stránky.",
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="wagtailimages.image",
verbose_name="Obrázek pro pozadí stránek",
),
),
]
...@@ -312,6 +312,16 @@ class UniwebHomePage( ...@@ -312,6 +312,16 @@ class UniwebHomePage(
): ):
### FIELDS ### FIELDS
fallback_image = models.ForeignKey(
"wagtailimages.Image",
on_delete=models.PROTECT,
blank=True,
null=True,
related_name="+",
verbose_name="Obrázek pro pozadí stránek",
help_text="Tento obrázek bude využit např. jako pozadí pro osobní stránky.",
)
calendar_page = models.ForeignKey( calendar_page = models.ForeignKey(
"UniwebCalendarPage", "UniwebCalendarPage",
verbose_name="Stránka s kalendářem", verbose_name="Stránka s kalendářem",
...@@ -394,6 +404,7 @@ class UniwebHomePage( ...@@ -394,6 +404,7 @@ class UniwebHomePage(
FieldPanel("matomo_id"), FieldPanel("matomo_id"),
FieldPanel("title_suffix"), FieldPanel("title_suffix"),
FieldPanel("narrow_layout"), FieldPanel("narrow_layout"),
FieldPanel("fallback_image"),
], ],
"nastavení webu", "nastavení webu",
), ),
...@@ -838,6 +849,14 @@ class UniwebPersonPage( ...@@ -838,6 +849,14 @@ class UniwebPersonPage(
else self.root_page.fallback_image else self.root_page.fallback_image
) )
def get_job_description(self):
"""
Vrací povolání + funkci, s čárkou mezi nima, pokud jsou obě definovaná, jinak vrátí jednu z nich
"""
if self.job and self.job_function:
return f"{self.job}, {self.job_function}"
return self.job or self.job_function or ""
def get_context(self, request): def get_context(self, request):
context = super().get_context(request) context = super().get_context(request)
# Na strance detailu cloveka se vpravo zobrazuji 3 dalsi nahodne profily # Na strance detailu cloveka se vpravo zobrazuji 3 dalsi nahodne profily
......
...@@ -83,6 +83,8 @@ ...@@ -83,6 +83,8 @@
</ui-app> </ui-app>
</nav> </nav>
{% block subheader %}{% endblock %}
<div class="container container--default py-8 lg:py-24 {% if page.root_page.narrow_layout %}max-w-screen-lg{% endif%}"> <div class="container container--default py-8 lg:py-24 {% if page.root_page.narrow_layout %}max-w-screen-lg{% endif%}">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>
......
...@@ -2,15 +2,18 @@ ...@@ -2,15 +2,18 @@
{% load static wagtailcore_tags wagtailimages_tags shared_filters %} {% load static wagtailcore_tags wagtailimages_tags shared_filters %}
{% block subheader %} {% block subheader %}
{% image page.get_background_photo fill-1920x500-c75 jpegquality-80 as bg_img %} {% if page.get_background_photo %}
{% image page.get_background_photo fill-1920x500-c75 jpegquality-80 as bg_img %}
<header class="hero hero--image pt-16 pb-24 lg:pt-32 pb-24" style="--image-url: url({{ bg_img.full_url }})"> <header class="hero hero--image pt-16 pb-24 lg:pt-32 pb-24" style="--image-url: url({{ bg_img.full_url }})">
{% else %}
<header class="hero hero--image pt-16 pb-24 lg:pt-32 pb-24 bg-grey-800">
{% endif %}
<div class="container container--default text-center lg:text-left"> <div class="container container--default text-center lg:text-left">
<h1 class="head-alt-lg md:head-alt-xl text-shadow-lg max-w-2xl"> <h1 class="head-alt-lg md:head-alt-xl text-shadow-lg max-w-2xl">
{{ page.title }} {{ page.title }}
</h1> </h1>
<h2 class="head-xs text-shadow-lg mt-2 max-w-xl"> <h2 class="head-xs text-shadow-lg mt-2 max-w-xl">
{{ page.job | default_if_none:"" }} {{ page.get_job_description }}
</h2> </h2>
</div> </div>
</header> </header>
...@@ -130,6 +133,14 @@ ...@@ -130,6 +133,14 @@
</a> </a>
</div> </div>
{% endif %} {% endif %}
{% if page.city %}
<div>
<h4>Město</h4>
<div class="contact-line icon-link content-block--nostyle">
<i class="ico--home"></i><span>{{ page.city }}</span>
</div>
</div>
{% endif %}
</div> </div>
</div> </div>
{% endif %} {% endif %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment