From e553454083eabf89f7510f3c01090be779e5a77e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomi=20Valentov=C3=A1?= <git@imaniti.org>
Date: Wed, 7 Aug 2024 12:00:12 +0200
Subject: [PATCH] add help docs & improve people page change view

---
 district/models.py    | 29 ++++++++++++++++++++++++++++-
 shared/models/main.py |  9 +++++++--
 2 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/district/models.py b/district/models.py
index 545dffbd..453a7b5a 100644
--- a/district/models.py
+++ b/district/models.py
@@ -5,6 +5,7 @@ from django.conf import settings
 from django.contrib import messages
 from django.core.cache import cache
 from django.core.exceptions import ValidationError
+from django.utils.safestring import mark_safe
 from django.db import models
 from django.http import HttpResponseRedirect
 from modelcluster.contrib.taggit import ClusterTaggableManager
@@ -12,6 +13,7 @@ from modelcluster.fields import ParentalKey, ParentalManyToManyField
 from taggit.models import TaggedItemBase
 from wagtail.admin.panels import (
     FieldPanel,
+    HelpPanel,
     InlinePanel,
     MultiFieldPanel,
     ObjectList,
@@ -586,9 +588,34 @@ class DistrictPeoplePage(MainPeoplePageMixin):
 
     ### PANELS
 
+    content_panels = Page.content_panels + [
+        MultiFieldPanel(
+            [
+                FieldPanel("perex_col_1", heading="První sloupec"),
+                FieldPanel("perex_col_2", heading="Druhý sloupec"),
+            ],
+            "Perex"
+        ),
+        MultiFieldPanel(
+            [
+                HelpPanel(
+                    content=mark_safe(
+                        "Pokud chceš importovat skupinu osob z Chobotnice, můžeš přidat do "
+                        "sekce <em>Lidé a týmy</em> blok <em>Skupina z Chobotnice</em>. Do "
+                        "zkratky skupiny můžeš vyplnit například <em>cen_ao_ved</em> pro "
+                        "skupinu <a href='https://pi2.cz/chobo-ao'>Administrativní odbor - "
+                        " vedení</a>."
+                    ),
+                ),
+                FieldPanel("content")
+            ],
+            "Obsah"
+        )
+    ]
+
     edit_handler = TabbedInterface(
         [
-            ObjectList(MainPeoplePageMixin.content_panels, heading="Obsah"),
+            ObjectList(content_panels, heading="Obsah"),
             ObjectList(MainPeoplePageMixin.promote_panels, heading="Metadata"),
         ]
     )
diff --git a/shared/models/main.py b/shared/models/main.py
index a1fef210..4574534d 100644
--- a/shared/models/main.py
+++ b/shared/models/main.py
@@ -1854,8 +1854,13 @@ class MainPeoplePageMixin(
     ### PANELS
 
     content_panels = Page.content_panels + [
-        FieldPanel("perex_col_1"),
-        FieldPanel("perex_col_2"),
+        MultiFieldPanel(
+            [
+                FieldPanel("perex_col_1", heading="První sloupec"),
+                FieldPanel("perex_col_2", heading="Druhý sloupec"),
+            ],
+            "Perex"
+        ),
         FieldPanel("content"),
     ]
 
-- 
GitLab