diff --git a/cdhweb/pages/migrations/0052_purplemode.py b/cdhweb/pages/migrations/0052_purplemode.py new file mode 100644 index 00000000..7936d314 --- /dev/null +++ b/cdhweb/pages/migrations/0052_purplemode.py @@ -0,0 +1,43 @@ +# Generated by Django 5.0.5 on 2024-07-03 21:59 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ( + "cdhpages", + "0051_sitealert_alter_contentpage_body_alter_homepage_body_and_more", + ), + ("wagtailcore", "0089_log_entry_data_json_null_to_object"), + ] + + operations = [ + migrations.CreateModel( + name="PurpleMode", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("purple_mode", models.BooleanField(default=False)), + ( + "site", + models.OneToOneField( + editable=False, + on_delete=django.db.models.deletion.CASCADE, + to="wagtailcore.site", + ), + ), + ], + options={ + "abstract": False, + }, + ), + ] diff --git a/cdhweb/pages/migrations/0053_alter_purplemode_options_and_more.py b/cdhweb/pages/migrations/0053_alter_purplemode_options_and_more.py new file mode 100644 index 00000000..d934a1a5 --- /dev/null +++ b/cdhweb/pages/migrations/0053_alter_purplemode_options_and_more.py @@ -0,0 +1,24 @@ +# Generated by Django 5.0.5 on 2024-07-03 22:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("cdhpages", "0052_purplemode"), + ] + + operations = [ + migrations.AlterModelOptions( + name="purplemode", + options={"verbose_name": "Purple Site Setting"}, + ), + migrations.AlterField( + model_name="purplemode", + name="purple_mode", + field=models.BooleanField( + default=False, + help_text="This will turn the site purple \n by transforming all shades of cyan on the site into shades of purple", + ), + ), + ] diff --git a/cdhweb/pages/models.py b/cdhweb/pages/models.py index 0dea0a64..ea9a5e28 100644 --- a/cdhweb/pages/models.py +++ b/cdhweb/pages/models.py @@ -18,6 +18,7 @@ TabbedInterface, ) from wagtail.blocks import RichTextBlock, StreamBlock, StructBlock, TextBlock +from wagtail.contrib.settings.models import BaseSiteSetting, register_setting from wagtail.documents.blocks import DocumentChooserBlock from wagtail.documents.models import AbstractDocument, DocumentQuerySet from wagtail.embeds.blocks import EmbedBlock @@ -598,3 +599,17 @@ def clean_fields(self, exclude=None): # require end date to be greater than start date if self.start_date and self.end_date and not self.end_date >= self.start_date: raise ValidationError("End date must be after start date") + + +@register_setting(icon="edit") +class PurpleMode(BaseSiteSetting): + purple_mode = models.BooleanField( + default=False, + help_text="""This will turn the site purple + by transforming all shades of cyan on the site into shades of purple""", + ) + + panels = [FieldPanel("purple_mode", icon="pick")] + + class Meta: + verbose_name = "Purple Site Setting" diff --git a/cdhweb/projects/migrations/0028_alter_project_accordion.py b/cdhweb/projects/migrations/0028_alter_project_accordion.py new file mode 100644 index 00000000..f56e4480 --- /dev/null +++ b/cdhweb/projects/migrations/0028_alter_project_accordion.py @@ -0,0 +1,80 @@ +# Generated by Django 5.0.5 on 2024-07-03 21:43 + +import wagtail.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("projects", "0027_project_accordion_alter_project_description_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="project", + name="accordion", + field=wagtail.fields.StreamField( + [ + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.ChoiceBlock( + choices=[ + ("code", "Code"), + ("data", "Data"), + ( + "documentation", + "Documentation", + ), + ("analysis", "Analysis"), + ( + "related_courses_and_course_modules", + "Related Courses and Course Modules", + ), + ( + "project_peer_review", + "Project Peer Review", + ), + ("awards", "Awards"), + ] + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "document-link", + "h3", + "h4", + ] + ), + ), + ] + ) + ), + ) + ], + label="Project Accordion", + ), + ) + ], + blank=True, + use_json_field=True, + verbose_name="Project Details", + ), + ), + ] diff --git a/cdhweb/settings/components/base.py b/cdhweb/settings/components/base.py index 626e7eae..50de0b75 100644 --- a/cdhweb/settings/components/base.py +++ b/cdhweb/settings/components/base.py @@ -143,7 +143,7 @@ "django.template.context_processors.media", "django.template.context_processors.request", "django.template.context_processors.tz", - # "wagtail.contrib.settings.context_processors.settings", + "wagtail.contrib.settings.context_processors.settings", # "wagtailmenus.context_processors.wagtailmenus", "cdhweb.context_extras", "cdhweb.context_processors.template_settings", @@ -176,6 +176,7 @@ "wagtail.contrib.routable_page", # required to avoid https://github.com/wagtail/wagtail/issues/1824 "wagtail.contrib.search_promotions", + "wagtail.contrib.settings", "wagtail.contrib.typed_table_block", "wagtail.embeds", "wagtail.sites", diff --git a/cdhweb/static_src/global/css-variables/palette.scss b/cdhweb/static_src/global/css-variables/palette.scss index 4df1418a..992db9dd 100644 --- a/cdhweb/static_src/global/css-variables/palette.scss +++ b/cdhweb/static_src/global/css-variables/palette.scss @@ -10,6 +10,14 @@ --color-brand-110: #04cad9; --color-brand-120: #1fa4ae; + // Brand alt (purple mode) + --color-brand-alt-5: #f3eaff; + --color-brand-alt-10: #d5c7e6; + --color-brand-alt-40: #c1acdc; + --color-brand-alt-100: #9a81ba; + --color-brand-alt-110: #735c96; + --color-brand-alt-120: #533f73; + // Secondary --color-red-100: #ed0000; diff --git a/cdhweb/static_src/global/elements/page.scss b/cdhweb/static_src/global/elements/page.scss index b9204438..881a824d 100644 --- a/cdhweb/static_src/global/elements/page.scss +++ b/cdhweb/static_src/global/elements/page.scss @@ -10,6 +10,15 @@ html { transition-duration: 0.001ms !important; } } + + &.purple-mode { + --color-brand-5: var(--color-brand-alt-5); + --color-brand-10: var(--color-brand-alt-10); + --color-brand-40: var(--color-brand-alt-40); + --color-brand-100: var(--color-brand-alt-100); + --color-brand-110: var(--color-brand-alt-110); + --color-brand-120: var(--color-brand-alt-120); + } } body { diff --git a/templates/base.html b/templates/base.html index 122819b4..5b7aec9d 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,8 @@ {% load static wagtailuserbar wagtailcore_tags wagtailimages_tags core_tags %} - + + + {% block title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}{% endblock %}{% block title_suffix %}{% endblock %} @@ -32,7 +34,6 @@ -