Skip to content
Snippets Groups Projects
Commit 473b289f authored by OndraRehounek's avatar OndraRehounek
Browse files

district and region: Person other links

parent 3e5615c5
No related branches found
No related tags found
2 merge requests!435Release upgrades,!430Feature/majak misc enhancements
Pipeline #7133 passed
......@@ -138,6 +138,16 @@ class PeopleGroupListBlock(StructBlock):
label = "Skupina členů"
class PersonUrlBlock(StructBlock):
title = CharBlock(label="Název", required=True)
url = URLBlock(label="URL", required=True)
custom_icon = CharBlock(
label="Vlastní ikonka ze styleguide",
required=False,
help_text="Pro vlastní ikonku zadejde název ikonky z https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons (bez tečky), např. 'ico--beer'",
)
class ProgramItemBlock(StructBlock):
title = CharBlock(label="Název", required=True)
completion_percentage = IntegerBlock(label="Procento dokončení", required=True)
......
# Generated by Django 3.2.11 on 2022-03-03 08:46
import wagtail.core.blocks
import wagtail.core.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("district", "0035_remove_districtpersonpage_perex"),
]
operations = [
migrations.AddField(
model_name="districtpersonpage",
name="other_urls",
field=wagtail.core.fields.StreamField(
[
(
"other_url",
wagtail.core.blocks.StructBlock(
[
(
"title",
wagtail.core.blocks.CharBlock(
label="Název", required=True
),
),
(
"url",
wagtail.core.blocks.URLBlock(
label="URL", required=True
),
),
(
"custom_icon",
wagtail.core.blocks.CharBlock(
help_text="Pro vlastní ikonku zadejde název ikonky z https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons (bez tečky), např. 'ico--beer'",
label="Vlastní ikonka ze styleguide",
required=False,
),
),
]
),
)
],
blank=True,
verbose_name="Další odkaz",
),
),
]
......@@ -14,7 +14,6 @@ from wagtail.admin.edit_handlers import (
PageChooserPanel,
StreamFieldPanel,
)
from wagtail.core import blocks
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page
from wagtail.images.edit_handlers import ImageChooserPanel
......@@ -24,18 +23,7 @@ from calendar_utils.models import CalendarMixin
from shared.models import ArticleMixin, SubpageMixin
from uniweb.constants import RICH_TEXT_FEATURES
from .blocks import (
AddressBlock,
CandidateListBlock,
CenterContactBlock,
ContactItemBlock,
ElectionHeaderBlock,
HomepageHeaderBlock,
HomepageSimpleHeaderBlock,
PeopleGroupListBlock,
RedmineProgramBlock,
StaticProgramBlock,
)
from .blocks import *
class DistrictHomePage(MetadataPageMixin, CalendarMixin, Page):
......@@ -465,6 +453,11 @@ class DistrictPersonPage(SubpageMixin, MetadataPageMixin, Page):
twitter_url = models.URLField("Odkaz na Twitter", blank=True, null=True)
youtube_url = models.URLField("Odkaz na Youtube kanál", blank=True, null=True)
flickr_url = models.URLField("Odkaz na Flickr", blank=True, null=True)
other_urls = StreamField(
[("other_url", PersonUrlBlock())],
verbose_name="Další odkaz",
blank=True,
)
### PANELS
......@@ -501,6 +494,7 @@ class DistrictPersonPage(SubpageMixin, MetadataPageMixin, Page):
FieldPanel("twitter_url"),
FieldPanel("youtube_url"),
FieldPanel("flickr_url"),
StreamFieldPanel("other_urls"),
],
"Sociální sítě",
),
......
......@@ -62,6 +62,17 @@
<i class="ico--flickr"></i>
</a>
{% endif %}
{% for person_link_block in page.other_urls %}
<a
href="{{ person_link_block.value.url }}"
target="_blank"
class="social-icon"
rel="noreferrer noopener"
title="{{ person_link_block.value.title }}"
>
<i class="{% firstof person_link_block.value.custom_icon 'ico--globe' %}"></i>
</a>
{% endfor %}
</div>
<hr>
......
......@@ -138,6 +138,16 @@ class PeopleGroupListBlock(StructBlock):
label = "Skupina členů"
class PersonUrlBlock(StructBlock):
title = CharBlock(label="Název", required=True)
url = URLBlock(label="URL", required=True)
custom_icon = CharBlock(
label="Vlastní ikonka ze styleguide",
required=False,
help_text="Pro vlastní ikonku zadejde název ikonky z https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons (bez tečky), např. 'ico--beer'",
)
class ProgramItemBlock(StructBlock):
title = CharBlock(label="Název", required=True)
completion_percentage = IntegerBlock(label="Procento dokončení", required=True)
......
# Generated by Django 3.2.11 on 2022-03-03 08:46
import wagtail.core.blocks
import wagtail.core.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("region", "0012_remove_regionpersonpage_perex"),
]
operations = [
migrations.AddField(
model_name="regionpersonpage",
name="other_urls",
field=wagtail.core.fields.StreamField(
[
(
"other_url",
wagtail.core.blocks.StructBlock(
[
(
"title",
wagtail.core.blocks.CharBlock(
label="Název", required=True
),
),
(
"url",
wagtail.core.blocks.URLBlock(
label="URL", required=True
),
),
(
"custom_icon",
wagtail.core.blocks.CharBlock(
help_text="Pro vlastní ikonku zadejde název ikonky z https://styleguide.pirati.cz/latest/?p=viewall-atoms-icons (bez tečky), např. 'ico--beer'",
label="Vlastní ikonka ze styleguide",
required=False,
),
),
]
),
)
],
blank=True,
verbose_name="Další odkaz",
),
),
]
......@@ -14,7 +14,6 @@ from wagtail.admin.edit_handlers import (
PageChooserPanel,
StreamFieldPanel,
)
from wagtail.core import blocks
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page
from wagtail.images.edit_handlers import ImageChooserPanel
......@@ -24,18 +23,7 @@ from calendar_utils.models import CalendarMixin
from shared.models import ArticleMixin, SubpageMixin
from uniweb.constants import RICH_TEXT_FEATURES
from .blocks import (
AddressBlock,
CandidateListBlock,
CenterContactBlock,
ContactItemBlock,
ElectionHeaderBlock,
HomepageHeaderBlock,
HomepageSimpleHeaderBlock,
PeopleGroupListBlock,
RedmineProgramBlock,
StaticProgramBlock,
)
from .blocks import *
class RegionHomePage(MetadataPageMixin, CalendarMixin, Page):
......@@ -461,6 +449,11 @@ class RegionPersonPage(SubpageMixin, MetadataPageMixin, Page):
twitter_url = models.URLField("Odkaz na Twitter", blank=True, null=True)
youtube_url = models.URLField("Odkaz na Youtube kanál", blank=True, null=True)
flickr_url = models.URLField("Odkaz na Flickr", blank=True, null=True)
other_urls = StreamField(
[("other_url", PersonUrlBlock())],
verbose_name="Další odkaz",
blank=True,
)
### PANELS
......
......@@ -62,6 +62,17 @@
<i class="ico--flickr"></i>
</a>
{% endif %}
{% for person_link_block in page.other_urls %}
<a
href="{{ person_link_block.value.url }}"
target="_blank"
class="social-icon"
rel="noreferrer noopener"
title="{{ person_link_block.value.title }}"
>
<i class="{% firstof person_link_block.value.custom_icon 'ico--globe' %}"></i>
</a>
{% endfor %}
</div>
<hr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment