diff --git a/district/migrations/0045_districthomepage_custom_logo_districthomepage_flickr_and_more.py b/district/migrations/0045_districthomepage_custom_logo_districthomepage_flickr_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..f9adfb0bdc19015aa56caab8b077f46856d8e925 --- /dev/null +++ b/district/migrations/0045_districthomepage_custom_logo_districthomepage_flickr_and_more.py @@ -0,0 +1,126 @@ +# Generated by Django 4.0.3 on 2022-03-18 14:13 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailimages", "0023_add_choose_permissions"), + ("district", "0044_remove_districtarticlepage_text_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="districthomepage", + name="custom_logo", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="wagtailimages.image", + ), + ), + migrations.AddField( + model_name="districthomepage", + name="flickr", + field=models.URLField( + blank=True, + default="https://www.flickr.com/photos/pirati/", + null=True, + verbose_name="Flickr URL", + ), + ), + migrations.AddField( + model_name="districthomepage", + name="instagram", + field=models.URLField( + blank=True, + default="https://www.instagram.com/pirati.cz/", + null=True, + verbose_name="Instagram URL", + ), + ), + migrations.AddField( + model_name="districthomepage", + name="show_eshop_link", + field=models.BooleanField( + default=True, verbose_name="Zobrazit v záhlaví odkaz na pirátský eshop" + ), + ), + migrations.AddField( + model_name="districthomepage", + name="show_magazine_link", + field=models.BooleanField( + default=True, verbose_name="Zobrazit v záhlaví odkaz na pirátské listy" + ), + ), + migrations.AddField( + model_name="districthomepage", + name="show_pirati_cz_link", + field=models.BooleanField( + default=True, verbose_name="Zobrazit v záhlaví odkaz 'pirati.cz'" + ), + ), + migrations.AlterField( + model_name="districthomepage", + name="contact_newcomers", + field=models.URLField( + blank=True, + default="https://nalodeni.pirati.cz", + null=True, + verbose_name="URL pro zájemce o členství", + ), + ), + migrations.AlterField( + model_name="districthomepage", + name="donation_page", + field=models.URLField( + blank=True, + default="https://dary.pirati.cz", + null=True, + verbose_name="URL pro příjem darů (tlačítko Přispěj)", + ), + ), + migrations.AlterField( + model_name="districthomepage", + name="facebook", + field=models.URLField( + blank=True, + default="https://www.facebook.com/ceska.piratska.strana", + null=True, + verbose_name="Facebook URL", + ), + ), + migrations.AlterField( + model_name="districthomepage", + name="forum", + field=models.URLField( + blank=True, + default="https://forum.pirati.cz/", + null=True, + verbose_name="Fórum URL", + ), + ), + migrations.AlterField( + model_name="districthomepage", + name="twitter", + field=models.URLField( + blank=True, + default="https://www.twitter.com/PiratskaStrana", + null=True, + verbose_name="Twitter URL", + ), + ), + migrations.AlterField( + model_name="districthomepage", + name="youtube", + field=models.URLField( + blank=True, + default="https://www.youtube.com/channel/UC_zxYLGrkmrYazYt0MzyVlA", + null=True, + verbose_name="YouTube URL", + ), + ), + ] diff --git a/district/models.py b/district/models.py index c409c8530a96a2ac0207bf04ca8c3ed2a070bf3a..f48aa0421d1939b637a8e07e0460be0b499ea84b 100644 --- a/district/models.py +++ b/district/models.py @@ -61,19 +61,68 @@ class DistrictHomePage(MenuMixin, MetadataPageMixin, CalendarMixin, Page): "Text tlačítka kalendáře", max_length=256, default="Kalendář" ) - facebook = models.URLField("Facebook URL", blank=True, null=True) - twitter = models.URLField("Twitter URL", blank=True, null=True) - youtube = models.URLField("YouTube URL", blank=True, null=True) - forum = models.URLField("Fórum URL", blank=True, null=True) + custom_logo = models.ForeignKey( + "wagtailimages.Image", blank=True, null=True, on_delete=models.SET_NULL + ) + + show_pirati_cz_link = models.BooleanField( + "Zobrazit v záhlaví odkaz 'pirati.cz'", default=True + ) + show_eshop_link = models.BooleanField( + "Zobrazit v záhlaví odkaz na pirátský eshop", default=True + ) + show_magazine_link = models.BooleanField( + "Zobrazit v záhlaví odkaz na pirátské listy", default=True + ) + + facebook = models.URLField( + "Facebook URL", + blank=True, + null=True, + default="https://www.facebook.com/ceska.piratska.strana", + ) + twitter = models.URLField( + "Twitter URL", + blank=True, + null=True, + default="https://www.twitter.com/PiratskaStrana", + ) + youtube = models.URLField( + "YouTube URL", + blank=True, + null=True, + default="https://www.youtube.com/channel/UC_zxYLGrkmrYazYt0MzyVlA", + ) + instagram = models.URLField( + "Instagram URL", + blank=True, + null=True, + default="https://www.instagram.com/pirati.cz/", + ) + flickr = models.URLField( + "Flickr URL", + blank=True, + null=True, + default="https://www.flickr.com/photos/pirati/", + ) + forum = models.URLField( + "Fórum URL", blank=True, null=True, default="https://forum.pirati.cz/" + ) contact_email = models.EmailField("kontaktni email", max_length=250, blank=True) contact_phone = models.TextField("kontaktni telefon", max_length=250, blank=True) contact_newcomers = models.URLField( - "URL pro zájemce o členství", blank=True, null=True + "URL pro zájemce o členství", + blank=True, + null=True, + default="https://nalodeni.pirati.cz", ) donation_page = models.URLField( - "URL pro příjem darů (tlačítko Přispěj)", blank=True, null=True + "URL pro příjem darů (tlačítko Přispěj)", + blank=True, + null=True, + default="https://dary.pirati.cz", ) # Lide uvedeni v paticce @@ -122,21 +171,25 @@ class DistrictHomePage(MenuMixin, MetadataPageMixin, CalendarMixin, Page): FieldPanel("show_calendar_on_hp"), ] - promote_panels = MetadataPageMixin.promote_panels + [ + settings_panels = [ + ImageChooserPanel("custom_logo"), + FieldPanel("matomo_id"), MultiFieldPanel( [ + FieldPanel("show_pirati_cz_link"), + FieldPanel("show_eshop_link"), + FieldPanel("show_magazine_link"), + FieldPanel("donation_page"), + FieldPanel("contact_newcomers"), FieldPanel("facebook"), - FieldPanel("forum"), FieldPanel("twitter"), FieldPanel("youtube"), + FieldPanel("instagram"), + FieldPanel("flickr"), + FieldPanel("forum"), ], - gettext_lazy("Social page configuration"), + gettext_lazy("Odkazy na webu"), ), - ] - - settings_panels = [ - FieldPanel("matomo_id"), - FieldPanel("donation_page"), MultiFieldPanel( [ FieldPanel("contact_email"), @@ -169,7 +222,7 @@ class DistrictHomePage(MenuMixin, MetadataPageMixin, CalendarMixin, Page): edit_handler = TabbedInterface( [ ObjectList(content_panels, heading="Obsah"), - ObjectList(promote_panels, heading="Propagovat"), + ObjectList(MetadataPageMixin.promote_panels, heading="Propagovat"), ObjectList(settings_panels, heading="Nastavení"), ObjectList(MenuMixin.menu_panels, heading="Menu"), ] diff --git a/district/templates/district/base.html b/district/templates/district/base.html index 9e827574dccf7a9344ca18e28e03873703ecfea8..1b48ddbf20ab3212fdb2665f20519d1a2c0da104 100644 --- a/district/templates/district/base.html +++ b/district/templates/district/base.html @@ -39,7 +39,20 @@ <div class="navbar__brand my-4 flex items-center lg:block lg:pr-8 lg:my-0"> <a href="/"> - <img src="{% static "styleguide18/assets/images/logo-round-white.svg" %}" class="w-10 lg:w-full lg:border-r lg:border-grey-300 lg:pr-8" /> + {% if page.root_page.custom_logo %} + {% image page.root_page.custom_logo width-128 as logo %} + <img + src="{{ logo.url }}" + class="w-10 lg:w-full lg:border-r lg:border-grey-300 lg:pr-8" + alt="logo" + /> + {% else %} + <img + src="{% static "styleguide18/assets/images/logo-round-white.svg" %}" + class="w-10 lg:w-full lg:border-r lg:border-grey-300 lg:pr-8" + alt="logo" + /> + {% endif %} </a> <span class="lg:hidden pl-4 font-bold text-xl">Pirátská strana</span> </div> @@ -54,20 +67,26 @@ <div class="text-grey-200 text-sm lg:space-x-8 leading-loose lg:leading-normal"> - <a href="https://www.pirati.cz" class="contact-line icon-link content-block--nostyle block lg:inline-block" target="_blank" rel="noopener noreferrer"> - <i class="ico--home"></i> - <span>pirati.cz</span> - </a> - - <a href="https://piratskyobchod.cz" class="contact-line icon-link content-block--nostyle block lg:inline-block" target="_blank" rel="noopener noreferrer"> - <i class="ico--cart"></i> - <span>piratskyobchod.cz</span> - </a> - - <a href="http://www.piratskelisty.cz" class="contact-line icon-link content-block--nostyle block lg:inline-block" target="_blank" rel="noopener noreferrer"> - <i class="ico--newspaper"></i> - <span>Pirátské listy</span> - </a> + {% if page.root_page.show_pirati_cz_link %} + <a href="https://www.pirati.cz" class="contact-line icon-link content-block--nostyle block lg:inline-block" target="_blank" rel="noopener noreferrer"> + <i class="ico--home"></i> + <span>pirati.cz</span> + </a> + {% endif %} + + {% if page.root_page.show_eshop_link %} + <a href="https://piratskyobchod.cz" class="contact-line icon-link content-block--nostyle block lg:inline-block" target="_blank" rel="noopener noreferrer"> + <i class="ico--cart"></i> + <span>piratskyobchod.cz</span> + </a> + {% endif %} + + {% if page.root_page.show_magazine_link %} + <a href="http://www.piratskelisty.cz" class="contact-line icon-link content-block--nostyle block lg:inline-block" target="_blank" rel="noopener noreferrer"> + <i class="ico--newspaper"></i> + <span>Pirátské listy</span> + </a> + {% endif %} </div> @@ -94,7 +113,7 @@ </div> </div> </a> - <a href="https://nalodeni.pirati.cz" rel="noopener noreferrer" target="_blank" class="btn btn--icon btn--blue-300 btn--hoveractive btn--condensed btn--fullwidth md:btn--autowidth lg:text-sm xl:text-base"> + <a href={{ page.root_page.contact_newcomers|default:"https://nalodeni.pirati.cz" }}" rel="noopener noreferrer" target="_blank" class="btn btn--icon btn--blue-300 btn--hoveractive btn--condensed btn--fullwidth md:btn--autowidth lg:text-sm xl:text-base"> <div class="btn__body-wrap"> <div class="btn__body ">Naloď se</div> <div class="btn__icon "> diff --git a/region/migrations/0020_regionhomepage_custom_logo_regionhomepage_flickr_and_more.py b/region/migrations/0020_regionhomepage_custom_logo_regionhomepage_flickr_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..38c3bea3ab72ba3bc76e41cb345ec004e4e51092 --- /dev/null +++ b/region/migrations/0020_regionhomepage_custom_logo_regionhomepage_flickr_and_more.py @@ -0,0 +1,126 @@ +# Generated by Django 4.0.3 on 2022-03-18 14:28 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailimages", "0023_add_choose_permissions"), + ("region", "0019_remove_regionarticlepage_text_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="regionhomepage", + name="custom_logo", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="wagtailimages.image", + ), + ), + migrations.AddField( + model_name="regionhomepage", + name="flickr", + field=models.URLField( + blank=True, + default="https://www.flickr.com/photos/pirati/", + null=True, + verbose_name="Flickr URL", + ), + ), + migrations.AddField( + model_name="regionhomepage", + name="instagram", + field=models.URLField( + blank=True, + default="https://www.instagram.com/pirati.cz/", + null=True, + verbose_name="Instagram URL", + ), + ), + migrations.AddField( + model_name="regionhomepage", + name="show_eshop_link", + field=models.BooleanField( + default=True, verbose_name="Zobrazit v záhlaví odkaz na pirátský eshop" + ), + ), + migrations.AddField( + model_name="regionhomepage", + name="show_magazine_link", + field=models.BooleanField( + default=True, verbose_name="Zobrazit v záhlaví odkaz na pirátské listy" + ), + ), + migrations.AddField( + model_name="regionhomepage", + name="show_pirati_cz_link", + field=models.BooleanField( + default=True, verbose_name="Zobrazit v záhlaví odkaz 'pirati.cz'" + ), + ), + migrations.AlterField( + model_name="regionhomepage", + name="contact_newcomers", + field=models.URLField( + blank=True, + default="https://nalodeni.pirati.cz", + null=True, + verbose_name="URL pro zájemce o členství", + ), + ), + migrations.AlterField( + model_name="regionhomepage", + name="donation_page", + field=models.URLField( + blank=True, + default="https://dary.pirati.cz", + null=True, + verbose_name="URL pro příjem darů (tlačítko Přispěj)", + ), + ), + migrations.AlterField( + model_name="regionhomepage", + name="facebook", + field=models.URLField( + blank=True, + default="https://www.facebook.com/ceska.piratska.strana", + null=True, + verbose_name="Facebook URL", + ), + ), + migrations.AlterField( + model_name="regionhomepage", + name="forum", + field=models.URLField( + blank=True, + default="https://forum.pirati.cz/", + null=True, + verbose_name="Fórum URL", + ), + ), + migrations.AlterField( + model_name="regionhomepage", + name="twitter", + field=models.URLField( + blank=True, + default="https://www.twitter.com/PiratskaStrana", + null=True, + verbose_name="Twitter URL", + ), + ), + migrations.AlterField( + model_name="regionhomepage", + name="youtube", + field=models.URLField( + blank=True, + default="https://www.youtube.com/channel/UC_zxYLGrkmrYazYt0MzyVlA", + null=True, + verbose_name="YouTube URL", + ), + ), + ] diff --git a/region/models.py b/region/models.py index d09dc92995a0d3ce11c91dcc78a6c75c169d7ed4..8b7ecee30e0af6b01e2acd4efafcc5bbc3fee942 100644 --- a/region/models.py +++ b/region/models.py @@ -61,19 +61,68 @@ class RegionHomePage(MenuMixin, MetadataPageMixin, CalendarMixin, Page): "Text tlačítka kalendáře", max_length=256, default="Kalendář" ) - facebook = models.URLField("Facebook URL", blank=True, null=True) - twitter = models.URLField("Twitter URL", blank=True, null=True) - youtube = models.URLField("YouTube URL", blank=True, null=True) - forum = models.URLField("Fórum URL", blank=True, null=True) + custom_logo = models.ForeignKey( + "wagtailimages.Image", blank=True, null=True, on_delete=models.SET_NULL + ) + + show_pirati_cz_link = models.BooleanField( + "Zobrazit v záhlaví odkaz 'pirati.cz'", default=True + ) + show_eshop_link = models.BooleanField( + "Zobrazit v záhlaví odkaz na pirátský eshop", default=True + ) + show_magazine_link = models.BooleanField( + "Zobrazit v záhlaví odkaz na pirátské listy", default=True + ) + + facebook = models.URLField( + "Facebook URL", + blank=True, + null=True, + default="https://www.facebook.com/ceska.piratska.strana", + ) + twitter = models.URLField( + "Twitter URL", + blank=True, + null=True, + default="https://www.twitter.com/PiratskaStrana", + ) + youtube = models.URLField( + "YouTube URL", + blank=True, + null=True, + default="https://www.youtube.com/channel/UC_zxYLGrkmrYazYt0MzyVlA", + ) + instagram = models.URLField( + "Instagram URL", + blank=True, + null=True, + default="https://www.instagram.com/pirati.cz/", + ) + flickr = models.URLField( + "Flickr URL", + blank=True, + null=True, + default="https://www.flickr.com/photos/pirati/", + ) + forum = models.URLField( + "Fórum URL", blank=True, null=True, default="https://forum.pirati.cz/" + ) contact_email = models.EmailField("kontaktni email", max_length=250, blank=True) contact_phone = models.TextField("kontaktni telefon", max_length=250, blank=True) contact_newcomers = models.URLField( - "URL pro zájemce o členství", blank=True, null=True + "URL pro zájemce o členství", + blank=True, + null=True, + default="https://nalodeni.pirati.cz", ) donation_page = models.URLField( - "URL pro příjem darů (tlačítko Přispěj)", blank=True, null=True + "URL pro příjem darů (tlačítko Přispěj)", + blank=True, + null=True, + default="https://dary.pirati.cz", ) # Lide uvedeni v paticce @@ -135,15 +184,23 @@ class RegionHomePage(MenuMixin, MetadataPageMixin, CalendarMixin, Page): ] settings_panels = [ + ImageChooserPanel("custom_logo"), FieldPanel("matomo_id"), - FieldPanel("donation_page"), MultiFieldPanel( [ - FieldPanel("contact_email"), - FieldPanel("contact_phone"), + FieldPanel("show_pirati_cz_link"), + FieldPanel("show_eshop_link"), + FieldPanel("show_magazine_link"), + FieldPanel("donation_page"), FieldPanel("contact_newcomers"), + FieldPanel("facebook"), + FieldPanel("twitter"), + FieldPanel("youtube"), + FieldPanel("instagram"), + FieldPanel("flickr"), + FieldPanel("forum"), ], - gettext_lazy("Kontakty"), + gettext_lazy("Odkazy na webu"), ), MultiFieldPanel( [ @@ -169,7 +226,7 @@ class RegionHomePage(MenuMixin, MetadataPageMixin, CalendarMixin, Page): edit_handler = TabbedInterface( [ ObjectList(content_panels, heading="Obsah"), - ObjectList(promote_panels, heading="Propagovat"), + ObjectList(MetadataPageMixin.promote_panels, heading="Propagovat"), ObjectList(settings_panels, heading="Nastavení"), ObjectList(MenuMixin.menu_panels, heading="Menu"), ] diff --git a/region/templates/region/base.html b/region/templates/region/base.html index 9e827574dccf7a9344ca18e28e03873703ecfea8..4f1f13586ff79e854043ac2b83b746e7541d3cf6 100644 --- a/region/templates/region/base.html +++ b/region/templates/region/base.html @@ -39,7 +39,20 @@ <div class="navbar__brand my-4 flex items-center lg:block lg:pr-8 lg:my-0"> <a href="/"> - <img src="{% static "styleguide18/assets/images/logo-round-white.svg" %}" class="w-10 lg:w-full lg:border-r lg:border-grey-300 lg:pr-8" /> + {% if page.root_page.custom_logo %} + {% image page.root_page.custom_logo width-128 as logo %} + <img + src="{{ logo.url }}" + class="w-10 lg:w-full lg:border-r lg:border-grey-300 lg:pr-8" + alt="logo" + /> + {% else %} + <img + src="{% static "styleguide18/assets/images/logo-round-white.svg" %}" + class="w-10 lg:w-full lg:border-r lg:border-grey-300 lg:pr-8" + alt="logo" + /> + {% endif %} </a> <span class="lg:hidden pl-4 font-bold text-xl">Pirátská strana</span> </div> diff --git a/shared/templates/shared/social_icons_snippet.html b/shared/templates/shared/social_icons_snippet.html index dbcf521c0196aa9417b58b1f35b76f07b0676f55..bddeafb635592412fc357b578b7a7e91a48f7974 100644 --- a/shared/templates/shared/social_icons_snippet.html +++ b/shared/templates/shared/social_icons_snippet.html @@ -1,6 +1,14 @@ -<a href="{{ page.root_page.twitter|default:"https://www.twitter.com/PiratskaStrana" }}" rel="noopener noreferrer" target="_blank" title="Náš účet na Twitteru" class="social-icon "><i class="ico--twitter"></i></a> -<a href="{{ page.root_page.youtube|default:"https://www.youtube.com/channel/UC_zxYLGrkmrYazYt0MzyVlA" }}" rel="noopener noreferrer" target="_blank" title="Náš účet na YouTube" class="social-icon "><i class="ico--youtube"></i></a> -<a href="/feed.xml" rel="noopener noreferrer" target="_blank" title="Články tohoto webu v RSS" class="social-icon "><i class="ico--feed"></i></a> -<a href=https://www.instagram.com/pirati.cz/" rel="noopener noreferrer" target="_blank" title="Instagram - Česká pirátská strana" class="social-icon "><i class="ico--instagram"></i></a> -<a href=https://www.flickr.com/photos/pirati/" rel="noopener noreferrer" target="_blank" title="Flickr - Česká pirátská strana" class="social-icon "><i class="ico--flickr"></i></a> +{% if page.root_page.twitter %} + <a href="{{ page.root_page.twitter }}" rel="noopener noreferrer" target="_blank" title="Náš účet na Twitteru" class="social-icon "><i class="ico--twitter"></i></a> +{% endif %} +{% if page.root_page.youtube %} + <a href="{{ page.root_page.youtube }}" rel="noopener noreferrer" target="_blank" title="Náš účet na YouTube" class="social-icon "><i class="ico--youtube"></i></a> +{% endif %} +{% if page.root_page.instagram %} + <a href="https://www.instagram.com/pirati.cz/" rel="noopener noreferrer" target="_blank" title="Instagram - Česká pirátská strana" class="social-icon "><i class="ico--instagram"></i></a> +{% endif %} +{% if page.root_page.flickr %} + <a href="https://www.flickr.com/photos/pirati/" rel="noopener noreferrer" target="_blank" title="Flickr - Česká pirátská strana" class="social-icon "><i class="ico--flickr"></i></a> +{% endif %} +{#<a href="/feed.xml" rel="noopener noreferrer" target="_blank" title="Články tohoto webu v RSS" class="social-icon "><i class="ico--feed"></i></a>#} <a href="mailto:{{ page.root_page.contact_email|default:"info@pirati.cz" }}" class="social-icon "><i class="ico--envelope"></i></a>