diff --git a/home/migrations/0042_alter_homepage_background_section_and_more.py b/home/migrations/0042_alter_homepage_background_section_and_more.py
new file mode 100644
index 0000000..3b63771
--- /dev/null
+++ b/home/migrations/0042_alter_homepage_background_section_and_more.py
@@ -0,0 +1,64 @@
+# Generated by Django 5.0.9 on 2024-10-02 01:43
+
+import wagtail_color_panel.fields
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('home', '0041_homepage_externalraws'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='homepage',
+ name='background_section',
+ field=wagtail_color_panel.fields.ColorField(blank=True, default='#FFFFFF', max_length=250),
+ ),
+ migrations.AlterField(
+ model_name='homepage',
+ name='color_gradient_1',
+ field=wagtail_color_panel.fields.ColorField(blank=True, default='#FF4D79', max_length=250),
+ ),
+ migrations.AlterField(
+ model_name='homepage',
+ name='color_gradient_2',
+ field=wagtail_color_panel.fields.ColorField(blank=True, default='#FF809F', max_length=250),
+ ),
+ migrations.AlterField(
+ model_name='homepage',
+ name='color_primary',
+ field=wagtail_color_panel.fields.ColorField(blank=True, default='#ff4a67', max_length=250),
+ ),
+ migrations.AlterField(
+ model_name='homepage',
+ name='color_text_hero',
+ field=wagtail_color_panel.fields.ColorField(blank=True, default='#FFFFFF', max_length=250),
+ ),
+ migrations.AlterField(
+ model_name='homepage',
+ name='color_text_section',
+ field=wagtail_color_panel.fields.ColorField(blank=True, default='#FFFFFF', max_length=250),
+ ),
+ migrations.AlterField(
+ model_name='homepage',
+ name='navbar_background',
+ field=wagtail_color_panel.fields.ColorField(blank=True, default='#000000', max_length=250),
+ ),
+ migrations.AlterField(
+ model_name='homepage',
+ name='navbar_links_color',
+ field=wagtail_color_panel.fields.ColorField(blank=True, default='#FFFFFF', max_length=250),
+ ),
+ migrations.AlterField(
+ model_name='segmentpage',
+ name='background_section',
+ field=wagtail_color_panel.fields.ColorField(blank=True, default='#FFFFFF', max_length=250),
+ ),
+ migrations.AlterField(
+ model_name='segmentpage',
+ name='color_text_section',
+ field=wagtail_color_panel.fields.ColorField(blank=True, default='#000000', max_length=250),
+ ),
+ ]
diff --git a/home/migrations/0042_homepage_fonts.py b/home/migrations/0042_homepage_fonts.py
new file mode 100644
index 0000000..5b0f566
--- /dev/null
+++ b/home/migrations/0042_homepage_fonts.py
@@ -0,0 +1,19 @@
+# Generated by Django 5.0.9 on 2024-09-08 22:45
+
+import wagtail.fields
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('home', '0041_homepage_externalraws'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='homepage',
+ name='fonts',
+ field=wagtail.fields.StreamField([('fonts', 3)], blank=True, block_lookup={0: ('wagtail.blocks.CharBlock', (), {'max_length': 250, 'required': True}), 1: ('wagtail.blocks.URLBlock', (), {'required': True}), 2: ('wagtail.blocks.CharBlock', (), {'default': '#000000', 'max_length': 250, 'required': True}), 3: ('wagtail.blocks.StructBlock', [[('name', 0), ('section', 0), ('url', 1), ('font_size', 0), ('font_wight', 0), ('font_family', 0), ('font_color', 2)]], {})}),
+ ),
+ ]
diff --git a/home/migrations/0043_remove_homepage_fonts_homepage_primaryfontfamily_and_more.py b/home/migrations/0043_remove_homepage_fonts_homepage_primaryfontfamily_and_more.py
new file mode 100644
index 0000000..b4fd894
--- /dev/null
+++ b/home/migrations/0043_remove_homepage_fonts_homepage_primaryfontfamily_and_more.py
@@ -0,0 +1,37 @@
+# Generated by Django 5.0.9 on 2024-09-11 02:04
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('home', '0042_homepage_fonts'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='homepage',
+ name='fonts',
+ ),
+ migrations.AddField(
+ model_name='homepage',
+ name='primaryFontFamily',
+ field=models.CharField(default='sans-serif', max_length=250),
+ ),
+ migrations.AddField(
+ model_name='homepage',
+ name='primaryFontURL',
+ field=models.URLField(blank=True, max_length=250),
+ ),
+ migrations.AddField(
+ model_name='homepage',
+ name='secondaryFontFamily',
+ field=models.CharField(default='sans-serif', max_length=250),
+ ),
+ migrations.AddField(
+ model_name='homepage',
+ name='secondaryFontURL',
+ field=models.URLField(blank=True, max_length=250),
+ ),
+ ]
diff --git a/home/models.py b/home/models.py
index 18ce9c4..c751e97 100644
--- a/home/models.py
+++ b/home/models.py
@@ -1,9 +1,11 @@
from django.db import models
-from wagtail.fields import RichTextField, StreamField
-from wagtail.models import Page
-from wagtail.admin.panels import FieldPanel
from wagtail import blocks
+from wagtail.admin.panels import FieldPanel
+from wagtail.fields import RichTextField, StreamField
from wagtail.images.blocks import ImageChooserBlock
+from wagtail.models import Page
+from wagtail_color_panel.edit_handlers import NativeColorPanel
+from wagtail_color_panel.fields import ColorField
class HomePage(Page):
@@ -47,7 +49,9 @@ class HomePage(Page):
on_delete=models.SET_NULL,
related_name="+",
)
- hero_image_overlay_opacity = models.DecimalField(default=0.70, decimal_places=2, max_digits=3)
+ hero_image_overlay_opacity = models.DecimalField(
+ default=0.70, decimal_places=2, max_digits=3
+ )
hero_padding_left = models.CharField(max_length=250, default="20px")
hero_padding_right = models.CharField(max_length=250, default="20px")
footer_title = models.CharField(max_length=250, blank=True)
@@ -77,41 +81,54 @@ class HomePage(Page):
blank=True,
use_json_field=True,
)
- color_gradient_1 = models.CharField(max_length=250, blank=True, default="#FF4D79")
- color_gradient_2 = models.CharField(max_length=250, blank=True, default="#FF809F")
- color_primary = models.CharField(max_length=250, blank=True, default="#ff4a67")
- color_text_hero = models.CharField(max_length=250, blank=True, default="#FFFFFF")
+
+ primaryFontURL = models.URLField(max_length=250, blank=True)
+ primaryFontFamily = models.CharField(max_length=250, default="sans-serif")
+ secondaryFontURL = models.URLField(max_length=250, blank=True)
+ secondaryFontFamily = models.CharField(max_length=250, default="sans-serif")
+ color_gradient_1 = ColorField(max_length=250, blank=True, default="#FF4D79")
+ color_gradient_2 = ColorField(max_length=250, blank=True, default="#FF809F")
+ color_primary = ColorField(max_length=250, blank=True, default="#ff4a67")
+ color_text_hero = ColorField(max_length=250, blank=True, default="#FFFFFF")
+
show_time = models.BooleanField(default=True)
- background_section = models.CharField(max_length=250, blank=True, default="#FFFFFF")
- color_text_section = models.CharField(max_length=250, blank=True, default="white")
- navbar_background = models.CharField(max_length=250, default="transparent")
- navbar_links_color = models.CharField(max_length=250,default="white")
- message_show_time = models.CharField(max_length=250, blank=True, default="Próximamente...")
+ background_section = ColorField(max_length=250, blank=True, default="#FFFFFF")
+ color_text_section = ColorField(max_length=250, blank=True, default="#FFFFFF")
+ navbar_background = ColorField(max_length=250, blank=True, default="#000000")
+ navbar_links_color = ColorField(max_length=250, blank=True, default="#FFFFFF")
+ message_show_time = models.CharField(
+ max_length=250, blank=True, default="Próximamente..."
+ )
menu_links = StreamField(
- [
- (
- "menu_links",
- blocks.StructBlock(
- [
- ("text", blocks.CharBlock(max_length=250, required=True)),
- ("url",blocks.CharBlock(max_length=250, required=True, default="#")),
- ]
- ),
+ [
+ (
+ "menu_links",
+ blocks.StructBlock(
+ [
+ ("text", blocks.CharBlock(max_length=250, required=True)),
+ (
+ "url",
+ blocks.CharBlock(
+ max_length=250, required=True, default="#"
+ ),
+ ),
+ ]
),
- ],
- blank=True,
- use_json_field=True,
- )
+ ),
+ ],
+ blank=True,
+ use_json_field=True,
+ )
favicon = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
- help_text="max size 256x256 png format"
+ help_text="max size 256x256 png format",
)
footer_background = models.CharField(max_length=250, blank=True, default="#161E26")
- footer_color_text = models.CharField(max_length=250, blank=True, default="#9e9e9e")
+ footer_color_text = models.CharField(max_length=250, blank=True, default="#9e9e9e")
externalRaws = StreamField(
[
(
@@ -129,8 +146,8 @@ class HomePage(Page):
content_panels = Page.content_panels + [
FieldPanel("event"),
FieldPanel("favicon"),
- FieldPanel("navbar_background"),
- FieldPanel("navbar_links_color"),
+ NativeColorPanel("navbar_background"),
+ NativeColorPanel("navbar_links_color"),
FieldPanel("position_event"),
FieldPanel("about"),
FieldPanel("location"),
@@ -142,30 +159,40 @@ class HomePage(Page):
FieldPanel("logo_image_big"),
FieldPanel("hero_image"),
FieldPanel("hero_image_overlay_opacity"),
- FieldPanel("color_text_hero"),
+ NativeColorPanel("color_text_hero"),
FieldPanel("hero_padding_left"),
FieldPanel("hero_padding_right"),
- FieldPanel("color_gradient_1"),
- FieldPanel("color_gradient_2"),
- FieldPanel("color_primary"),
+ FieldPanel("primaryFontURL"),
+ FieldPanel("primaryFontFamily"),
+ FieldPanel("secondaryFontURL"),
+ FieldPanel("secondaryFontFamily"),
+ NativeColorPanel("color_gradient_1"),
+ NativeColorPanel("color_gradient_2"),
+ NativeColorPanel("color_primary"),
FieldPanel("show_time"),
- FieldPanel("background_section"),
- FieldPanel("color_text_section"),
+ NativeColorPanel("background_section"),
+ NativeColorPanel("color_text_section"),
FieldPanel("message_show_time"),
FieldPanel("menu_links"),
FieldPanel("footer_title"),
FieldPanel("footer_site_info"),
FieldPanel("footer_networks"),
- FieldPanel("footer_background"),
- FieldPanel("footer_color_text"),
+ NativeColorPanel("color_gradient_1"),
+ NativeColorPanel("footer_background"),
+ NativeColorPanel("footer_color_text"),
FieldPanel("externalRaws"),
]
-
+
def get_context(self, request):
# Update context to include only published posts, ordered by reverse-chron
context = super().get_context(request)
segments = SegmentPage.objects.child_of(self).live().order_by("order")
context["segments"] = segments # sorted (segments, key=lambda x: x.order)
+ context["exist_descendants"] = [
+ descendant
+ for descendant in self.get_descendants()
+ if descendant.live and descendant.content_type == self.content_type
+ ]
return context
@@ -188,6 +215,7 @@ class SponsorBlock(blocks.StructBlock):
)
url = blocks.URLBlock(required=False)
+
class TiersBlock(blocks.StructBlock):
classname = blocks.CharBlock(required=False)
name = blocks.CharBlock()
@@ -200,6 +228,7 @@ class TiersBlock(blocks.StructBlock):
url_text = blocks.CharBlock(required=False, default="Buy now")
bg_color = blocks.CharBlock(required=False, default="#fff")
+
class ScheduleDetailBlock(blocks.StructBlock):
menu_title = blocks.CharBlock()
menu_subtitle = blocks.CharBlock(default="Workshop")
@@ -210,15 +239,17 @@ class ScheduleDetailBlock(blocks.StructBlock):
location = blocks.CharBlock(required=False)
image = ImageChooserBlock(required=False)
+
class ScheduleBlock(blocks.StructBlock):
name = blocks.CharBlock()
detail = blocks.CharBlock()
schedule_details = blocks.ListBlock(ScheduleDetailBlock(required=False))
+
class SegmentPage(Page):
order = models.IntegerField(default=0)
- background_section = models.CharField(max_length=250, blank=True, default="#FFFFFF")
- color_text_section = models.CharField(max_length=250, blank=True, default="black")
+ background_section = ColorField(max_length=250, blank=True, default="#FFFFFF")
+ color_text_section = ColorField(max_length=250, blank=True, default="#000000")
segments = StreamField(
[
# detail segment
@@ -253,7 +284,8 @@ class SegmentPage(Page):
),
),
(
- "list_style",blocks.BooleanBlock(required=False, default=False),
+ "list_style",
+ blocks.BooleanBlock(required=False, default=False),
),
]
),
@@ -363,7 +395,12 @@ class SegmentPage(Page):
content_panels = Page.content_panels + [
FieldPanel("order"),
- FieldPanel("background_section"),
- FieldPanel("color_text_section"),
+ NativeColorPanel("color_text_section"),
FieldPanel("segments"),
+ NativeColorPanel("background_section"),
]
+
+ def get_context(self, request):
+ context = super().get_context(request)
+ context["parent"] = self.get_parent().specific
+ return context
diff --git a/home/templates/home/home_page.html b/home/templates/home/home_page.html
index f4e938d..9f98141 100644
--- a/home/templates/home/home_page.html
+++ b/home/templates/home/home_page.html
@@ -8,6 +8,29 @@
{% block extra_css %}
{% image page.hero_image fill-1900x740-c20 format-webp preserve-svg as tmp_hero %}
{% image page.favicon max-256x256 as tmp_favicon %}
+{% block meta_tags %}
+
+
+
+
+{% if page.logo_image %}
+ {% image page.logo_image original as tmp_og_image %}
+
+{% endif %}
+
+
+
+
+
+
+
+
+
+{% if page.logo_image %}
+ {% image page.logo_image original as tmp_twitter_image %}
+
+{% endif %}
+{% endblock %}
@@ -34,6 +59,15 @@
+
+{%if page.value.primaryFontURL != "" %}
+
+{%endif%}
+
+{%if page.value.secondaryFontURL != "" %}
+
+{%endif%}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock extra_css %}
+
+{% block content %}
+