diff --git a/district/migrations/0110_districthomepage_footer_extra_content.py b/district/migrations/0110_districthomepage_footer_extra_content.py new file mode 100644 index 0000000000000000000000000000000000000000..c302198ac646e1e288feeb19800a0057dc841460 --- /dev/null +++ b/district/migrations/0110_districthomepage_footer_extra_content.py @@ -0,0 +1,20 @@ +# Generated by Django 4.1.8 on 2023-05-01 14:58 + +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("district", "0109_alter_districthomepage_subheader"), + ] + + operations = [ + migrations.AddField( + model_name="districthomepage", + name="footer_extra_content", + field=wagtail.fields.RichTextField( + blank=True, verbose_name="Extra obsah pod šedou patičkou" + ), + ), + ] diff --git a/district/models.py b/district/models.py index 068867758bbfed270d1318982474fe5e9429b01a..0f0916338d6ab809b8788e978e7e9930b719b65d 100644 --- a/district/models.py +++ b/district/models.py @@ -188,6 +188,13 @@ class DistrictHomePage( use_json_field=True, ) + # Extra komentar v paticce + footer_extra_content = RichTextField( + verbose_name="Extra obsah pod šedou patičkou", + blank=True, + features=RICH_TEXT_DEFAULT_FEATURES, + ) + # settings matomo_id = models.IntegerField( "Matomo ID pro sledování návštěvnosti", blank=True, null=True @@ -244,6 +251,12 @@ class DistrictHomePage( ], gettext_lazy("Lidé v zápatí stránky"), ), + MultiFieldPanel( + [ + FieldPanel("footer_extra_content"), + ], + gettext_lazy("Extra obsah v patičce"), + ), MultiFieldPanel( [ FieldPanel("region_map_button_text"), diff --git a/district/templates/district/base.html b/district/templates/district/base.html index 0f20b30bd7e8579b8006969b559f882b8250e118..360bdcf8af6b7f0c7162013a380287b650489132 100644 --- a/district/templates/district/base.html +++ b/district/templates/district/base.html @@ -322,14 +322,19 @@ </section> </div> - {% if page.root_page.footer_person_list %} + {% if page.root_page.footer_person_list or page.root_page.footer_extra_content %} <section class="bg-black py-4 lg:py-12"> <div class="container container--default"> - <div class="grid gap-4 grid-cols-1 md:grid-cols-2 xl:grid-cols-3"> - {% for person_block in page.root_page.footer_person_list %} - {% include "shared/person_badge_snippet.html" with person_page=person_block.value.person title=person_block.value.position %} - {% endfor %} - </div> + <div class="grid gap-4 grid-cols-1 md:grid-cols-2 xl:grid-cols-3"> + {% if page.root_page.footer_person_list %} + {% for person_block in page.root_page.footer_person_list %} + {% include "shared/person_badge_snippet.html" with person_page=person_block.value.person title=person_block.value.position %} + {% endfor %} + {% endif %} + {% if page.root_page.footer_extra_content %} + {{ page.root_page.footer_extra_content|richtext }} + {% endif %} + </div> </div> </section> {% endif %} diff --git a/senat_campaign/migrations/0011_senatcampaignhomepage_footer_extra_content.py b/senat_campaign/migrations/0011_senatcampaignhomepage_footer_extra_content.py new file mode 100644 index 0000000000000000000000000000000000000000..45db68dc93362d83412d616fe6131a862d67b259 --- /dev/null +++ b/senat_campaign/migrations/0011_senatcampaignhomepage_footer_extra_content.py @@ -0,0 +1,20 @@ +# Generated by Django 4.1.8 on 2023-05-01 15:14 + +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("senat_campaign", "0010_alter_senatcampaignhomepage_about_gallery_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="senatcampaignhomepage", + name="footer_extra_content", + field=wagtail.fields.RichTextField( + blank=True, verbose_name="Extra obsah pod šedou patičkou" + ), + ), + ] diff --git a/senat_campaign/models.py b/senat_campaign/models.py index 7b68f07064a4ced0c76fa65e0299c9c045512deb..98556d4e85b527bf6650b039f7ff8420f2d417ee 100644 --- a/senat_campaign/models.py +++ b/senat_campaign/models.py @@ -124,6 +124,9 @@ class SenatCampaignHomePage( matomo_id = models.IntegerField( "Matomo ID pro sledování návštěvnosti", blank=True, null=True ) + footer_extra_content = RichTextField( + verbose_name="Extra obsah pod šedou patičkou", blank=True + ) ### PANELS @@ -188,6 +191,7 @@ class SenatCampaignHomePage( FieldPanel("matomo_id"), FieldPanel("title_suffix"), FieldPanel("contacts"), + FieldPanel("footer_extra_content"), CommentPanel(), ] diff --git a/senat_campaign/templates/senat_campaign/base.html b/senat_campaign/templates/senat_campaign/base.html index 12f90ae58568359ea2a8c5ce04b2e4c7546a407e..8408af067a5bf45627a4c37a240f89c8e4456507 100644 --- a/senat_campaign/templates/senat_campaign/base.html +++ b/senat_campaign/templates/senat_campaign/base.html @@ -201,12 +201,26 @@ <div class="footer__bottom"> <div class="container"> <div class="row"> - <div class="col-12 col-md-6 mb-3 mb-md-0"> - <p class="mb-0">{% now "Y" %} | Zadavatel: {{ page.root_page.full_name }} | Zpracovatel: Česká pirátská strana</p> - </div><!-- /column --> - <div class="col-12 col-md-6 text-md-right"> - <p class="mb-0">Tento web využívá soubory cookies - <a href="{{ page.root_page.cookies_page_url }}">více informací</a></p> - </div><!-- /column --> + {% if page.root_page.footer_extra_content %} + <div class="col-12 col-md-5 mb-3 mb-md-0"> + <p class="mb-0">{% now "Y" %} | Zadavatel: {{ page.root_page.full_name }} | Zpracovatel: Česká pirátská strana</p> + </div><!-- /column --> + <div class="col-12 col-md-3"> + <p class="mb-0"> + {{ page.root_page.footer_extra_content|richtext }} + </p> + </div> + <div class="col-12 col-md-4 text-md-right"> + <p class="mb-0">Tento web využívá soubory cookies - <a href="{{ page.root_page.cookies_page_url }}">více informací</a></p> + </div><!-- /column --> + {% else %} + <div class="col-12 col-md-6 mb-3 mb-md-0"> + <p class="mb-0">{% now "Y" %} | Zadavatel: {{ page.root_page.full_name }} | Zpracovatel: Česká pirátská strana</p> + </div><!-- /column --> + <div class="col-12 col-md-6 text-md-right"> + <p class="mb-0">Tento web využívá soubory cookies - <a href="{{ page.root_page.cookies_page_url }}">více informací</a></p> + </div><!-- /column --> + {% endif %} </div><!-- /row --> </div><!-- /container --> </div><!-- /footer_bottom --> diff --git a/uniweb/migrations/0042_uniwebhomepage_footer_extra_content.py b/uniweb/migrations/0042_uniwebhomepage_footer_extra_content.py new file mode 100644 index 0000000000000000000000000000000000000000..aa366e3354a9c44e43db204e96441763c12583e4 --- /dev/null +++ b/uniweb/migrations/0042_uniwebhomepage_footer_extra_content.py @@ -0,0 +1,20 @@ +# Generated by Django 4.1.8 on 2023-05-01 15:23 + +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("uniweb", "0041_alter_uniwebflexiblepage_content_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="uniwebhomepage", + name="footer_extra_content", + field=wagtail.fields.RichTextField( + blank=True, verbose_name="Extra obsah pod šedou patičkou" + ), + ), + ] diff --git a/uniweb/models.py b/uniweb/models.py index 42389c9de3ddf587262948ca1d37b00549c5bd25..70f746cb0949efbbea794c13da4f3be4d3e2ac66 100644 --- a/uniweb/models.py +++ b/uniweb/models.py @@ -1,3 +1,5 @@ +import random + from captcha.fields import CaptchaField from django import forms from django.core.paginator import Paginator @@ -31,7 +33,7 @@ from shared.models import ( ExtendedMetadataPageMixin, SubpageMixin, ) -from shared.utils import make_promote_panels +from shared.utils import make_promote_panels, strip_all_html_tags, trim_to_length from tuning import admin_help from .blocks import PeopleGroupListBlock, PersonCustomPositionBlock, PersonUrlBlock @@ -339,6 +341,11 @@ class UniwebHomePage( default=True, help_text="Zobrazit pirátská tlačítka", ) + footer_extra_content = RichTextField( + verbose_name="Extra obsah pod šedou patičkou", + blank=True, + features=RICH_TEXT_DEFAULT_FEATURES, + ) ### PANELS @@ -361,6 +368,7 @@ class UniwebHomePage( FieldPanel("show_logo"), FieldPanel("show_social_links"), FieldPanel("show_pirate_buttons"), + FieldPanel("footer_extra_content"), ], "nastavení patičky", ), diff --git a/uniweb/templates/uniweb/base.html b/uniweb/templates/uniweb/base.html index 7f17985382b858ce71d75d7c4f0fd8c3d208afa5..733e7c914bb3a376b317ed6d2abf6c735121df65 100644 --- a/uniweb/templates/uniweb/base.html +++ b/uniweb/templates/uniweb/base.html @@ -136,6 +136,15 @@ </div> </div> </ui-app> + {% if page.root_page.footer_extra_content %} + <section class="bg-black py-4 lg:py-12"> + <div class="container container--default"> + <div class="grid gap-4 grid-cols-1 md:grid-cols-2 xl:grid-cols-3"> + {{ page.root_page.footer_extra_content|richtext }} + </div> + </div> + </section> + {% endif %} </footer> <script src="{% static "shared/vendor/vue/vue.2.6.11.js" %}"></script>