From d15c9b85a54221b675c5bc9d00f5e8fc456dccc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <git@imaniti.org> Date: Fri, 29 Sep 2023 19:32:26 +0200 Subject: [PATCH] custom donation page for uniweb pages --- .../0050_uniwebhomepage_donation_page.py | 18 ++++++++++++++++++ uniweb/models.py | 7 +++++++ uniweb/templates/uniweb/base.html | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 uniweb/migrations/0050_uniwebhomepage_donation_page.py diff --git a/uniweb/migrations/0050_uniwebhomepage_donation_page.py b/uniweb/migrations/0050_uniwebhomepage_donation_page.py new file mode 100644 index 00000000..d4777be0 --- /dev/null +++ b/uniweb/migrations/0050_uniwebhomepage_donation_page.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.10 on 2023-09-29 17:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('uniweb', '0049_alter_uniwebcalendarpage_calendar_url_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='uniwebhomepage', + name='donation_page', + field=models.URLField(blank=True, default='https://dary.pirati.cz', null=True, verbose_name='URL pro příjem darů (tlačítko Darovat)'), + ), + ] diff --git a/uniweb/models.py b/uniweb/models.py index fdbbbabb..37c26947 100644 --- a/uniweb/models.py +++ b/uniweb/models.py @@ -374,6 +374,12 @@ class UniwebHomePage( blank=True, features=RICH_TEXT_DEFAULT_FEATURES, ) + donation_page = models.URLField( + "URL pro příjem darů (tlačítko Darovat)", + blank=True, + null=True, + default="https://dary.pirati.cz", + ) ### PANELS @@ -406,6 +412,7 @@ class UniwebHomePage( FieldPanel("show_pirate_buttons"), FieldPanel("footer_links"), FieldPanel("footer_extra_content"), + FieldPanel("donation_page"), ], "nastavení patičky", ), diff --git a/uniweb/templates/uniweb/base.html b/uniweb/templates/uniweb/base.html index 36cb6b92..d01cc530 100644 --- a/uniweb/templates/uniweb/base.html +++ b/uniweb/templates/uniweb/base.html @@ -117,7 +117,7 @@ </div> <div class="flex flex-col md:flex-row lg:flex-col lg:items-end space-y-2 md:space-y-0 md:space-x-2 lg:space-x-0 lg:space-y-2"> {% if page.root_page.show_pirate_buttons %} - <a href="https://dary.pirati.cz" class="btn btn--icon btn--cyan-200 btn--hoveractive text-lg btn--fullwidth sm:btn--autowidth"> + <a href="{{ page.root_page.donation_page }}" class="btn btn--icon btn--cyan-200 btn--hoveractive text-lg btn--fullwidth sm:btn--autowidth"> <div class="btn__body-wrap"> <div class="btn__body">Darovat</div> <div class="btn__icon"> -- GitLab