Skip to content

Commit

Permalink
Merge pull request #131 from springload/fix/bed-fixes
Browse files Browse the repository at this point in the history
purple mode
  • Loading branch information
sarahframe authored Jul 4, 2024
2 parents 7a7f355 + 95696fd commit c65261b
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 3 deletions.
43 changes: 43 additions & 0 deletions cdhweb/pages/migrations/0052_purplemode.py
Original file line number Diff line number Diff line change
@@ -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,
},
),
]
24 changes: 24 additions & 0 deletions cdhweb/pages/migrations/0053_alter_purplemode_options_and_more.py
Original file line number Diff line number Diff line change
@@ -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",
),
),
]
15 changes: 15 additions & 0 deletions cdhweb/pages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
80 changes: 80 additions & 0 deletions cdhweb/projects/migrations/0028_alter_project_accordion.py
Original file line number Diff line number Diff line change
@@ -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",
),
),
]
3 changes: 2 additions & 1 deletion cdhweb/settings/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions cdhweb/static_src/global/css-variables/palette.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
9 changes: 9 additions & 0 deletions cdhweb/static_src/global/elements/page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% load static wagtailuserbar wagtailcore_tags wagtailimages_tags core_tags %}
<!DOCTYPE html>
<html class="no-js" lang="en">

<html class="no-js{% if settings.cdhpages.PurpleMode.purple_mode %} purple-mode{% endif %}" lang="en">

<head>
<meta charset="utf-8">
<title>{% block title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}{% endblock %}{% block title_suffix %}{% endblock %}</title>
Expand Down Expand Up @@ -32,7 +34,6 @@
<script defer src="{% static 'dist/main.js' %}"></script><link href="{% static 'dist/styles.css' %}" rel="stylesheet"></head>

</head>

<body class="{% block body_class %}{% endblock %}">

<a class="skip-link" href="#content">
Expand Down

0 comments on commit c65261b

Please sign in to comment.