Skip to content

Commit

Permalink
Merge branch 'integration/2024-evolution' into content-prep
Browse files Browse the repository at this point in the history
  • Loading branch information
SharmaineLim committed Feb 10, 2025
2 parents 5d2582c + 4297f3d commit 97fc455
Show file tree
Hide file tree
Showing 208 changed files with 4,084 additions and 1,621 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Build site (_site directory name is used for Jekyll compatiblity)
run: mkdocs build --config-file ./mkdocs.yml --site-dir ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3

deploy:
needs: build
Expand Down
24 changes: 24 additions & 0 deletions docs/custom-features/divisions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Divisions

The site's target audience can be grouped into divisions; e.g. the charity division, the public sector division, and the Wagtail division. All content going forward can be associated to one of these divisions.

The idea is that if you're a charity organisation, you can find content that's specific and relevant for you because the relevant content will all be in one place.

This feature allows content to be associated to a specific `DivisionPage`, which allows us to display the same theme, logo and navigation for any content related to a division. (Because of this, a page should only have one associated division.)

## Options

The available options are dependent on the `DivisionPage`s that have been created.

## Division configuration

The `tbx.core.utils.models.DivisionMixin` provides a mechanism for associating a specific division with a page. It offers the following functionality:

- `division` field: Adds a ForeignKey field to associate a specific division with a page.
- `final_division`: A cached property that determines the appropriate division to associate to a page. It first checks if the page has a `division` specified. If not, it traverses the page's ancestors to find the first page that either has a `division` specified or is a `DivisionPage`, defaulting to `None`.

---

???+ note

Please ensure that the Editors' guide is updated accordingly whenever any changes are made to this feature. A private link, for Torchbox employees only, can be found at https://intranet.torchbox.com/torchbox-com-project-docs.
6 changes: 3 additions & 3 deletions docs/custom-features/theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ The Theme feature enables the customization of page styles through the applicati

The available color themes are defined using the `tbx.core.utils.models.ColourTheme` enumeration. Each theme option consists of a CSS class name and a human-readable label. The following themes are available:

- `ColourTheme.NONE`: No specific theme applied. When the theme is set to "None", this means we don't add a `theme-****` class to the page, and the default theme (_Coral_, at the time of writing these docs) is applied.
- `ColourTheme.NONE`: No specific theme applied. When the theme is set to "None", this means we don't add a `theme-****` class to the page, and the default theme (_Coral_, at the time of writing these docs) is applied (unless the page inherits a theme).
- `ColourTheme.CORAL`: Applies a `theme-coral` class to the page.
- `ColourTheme.NEBULINE`: Applies a `theme-nebuline` class to the page.
- `ColourTheme.LAGOON`: Applies a `theme-lagoon` class to the page.
- `ColourTheme.BANANA`: Applies a `theme-banana` class to the page.
- `ColourTheme.EARTH`: Applies a `theme-earth` class to the page.
- `ColourTheme.GREEN`: Applies a `theme-green` class to the page.

???+ tip

Expand Down
4 changes: 3 additions & 1 deletion docs/front-end/breakpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ $breakpoints: (
'x-large' '(min-width: 1280px)',
// secondary breakpoints - use sparingly
'small' '(min-width: 410px)',
'xx-large' '(min-width: 1800px)'
'menu' '(min-width: 800px)',
'xx-large' '(min-width: 1440px)',
'xxx-large' '(min-width: 1800px)'
);
```

Expand Down
4 changes: 2 additions & 2 deletions docs/front-end/fonts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The site uses 'Outfit' as the main font and 'sans-serif' as the fallback font.

Outfit is avaible from [Google Fonts](https://fonts.google.com/specimen/Outfit) and is a variable font. This means that the font can be loaded as a single file and the weight and style can be adjusted using CSS. Any weight between 300 and 600 can be used.
Outfit is avaible from [Google Fonts](https://fonts.google.com/specimen/Outfit) and is a variable font. This means that the font can be loaded as a single file and the weight and style can be adjusted using CSS. Any weight between 200 and 600 can be used.

We originally limited the number of font variants for reasons of sustainability, although the fact that this is a variable font means that extra weights could be added if required without impacting carbon emissions.

Expand All @@ -12,7 +12,7 @@ The font is loaded using the following CSS in `sass/base/_fonts.scss`:
@font-face {
font-family: 'Outfit';
font-style: normal;
font-weight: 300 600;
font-weight: 200 600;
font-display: swap;
src: url(../fonts/outfit-variable-font.woff2) format('woff2-variations');
}
Expand Down
2 changes: 1 addition & 1 deletion docs/front-end/grid.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Any alignment or spacing rules for a component should be added using BEM syntax
grid-column: 2 / span 4;

@include media-query(large) {
grid-column: 4 / span 9;
grid-column: 2 / span 9;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/front-end/themes_and_modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The CSS to set the mode is an html class of either `.mode-dark` or `.mode-light`

An editor has an option to select a theme on each page. Selecting a theme on a page will change it for that page, and all child pages, unless another selection is made further down the page tree.

There are currently 4 themes in use: coral, lagoon, banana and earth. The CSS to set the theme is an html class of either `.theme-coral`, `.theme-lagoon`, `.theme-banana` or `.theme-earth`.
There are currently 4 themes in use: coral, nebuline, lagoon and green. The CSS to set the theme is an html class of either `.theme-coral`, `.theme-nebuline`, `.theme-lagoon` or `.theme-green`.

???+ note

Expand Down
2 changes: 1 addition & 1 deletion docs/front-end/utility-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Most CSS classes used in this build are designed to fit with a particular compon

Some, such as the `listing` component are designed to be a base with variations across a number of variant components - this is made clear by the component naming: `listing--image.html`, `listing--simple.html` etc.

However, we have some utility classes which are designed for re-use, along with the option to to use Tailwind utility classes. Classes that are designed for re-use include `button`, `heading--[xyz]`, `link`, `supporting`, `.body` and `icon--listing-arrow`.
However, we have some utility classes which are designed for re-use, along with the option to to use Tailwind utility classes. Classes that are designed for re-use include `button`, `heading--[xyz]`, `text--[xyz]`, `link`, and `icon--listing-arrow`.

The same tailwind utility classes that are avialable in `wagtail-kit` are available in this build. `tailwind.config.js` includes the custom spacing for the build, allowing us to use classes such as `mb-spacerMini` where it wouldn't be practical to create a new scss component just for a one-off spacing adjustment.
5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ nav:
- front-end/incident-form.md
- 'Navigation': 'navigation.md'
- 'Custom features':
- 'Contact': 'custom-features/contact.md'
- 'Division': 'custom-features/divisions.md'
- 'Migration-friendly StreamFields': 'custom-features/migration-friendly-streamfields.md'
- 'Theme': 'custom-features/theme.md'
- 'Modes': 'custom-features/modes.md'
- 'Contact': 'custom-features/contact.md'
- 'Theme': 'custom-features/theme.md'
- 'Continuous integration': 'continuous-integration.md'
- 'Anonymised data': 'anonymised-data.md'
- 'Data import': 'data-import.md'
Expand Down
21 changes: 20 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
},
"dependencies": {
"js-cookie": "^3.0.5",
"lite-youtube-embed": "^0.3.2"
"lite-youtube-embed": "^0.3.2",
"swiper": "^11.2.1"
}
}
6 changes: 2 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ mkdocs-material = "^9.5.41"
pymdown-extensions = "^10.11.2"

# Testing
factory-boy = "^3.3.0"
faker = "^33.3.0"
wagtail-factories = "^4.2.1"


Expand Down
42 changes: 42 additions & 0 deletions tbx/blog/migrations/0027_update_theme_colour_choices.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Generated by Django 4.2.16 on 2024-12-09 08:08

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("blog", "0026_add_earth_colour_theme"),
]

operations = [
migrations.AlterField(
model_name="blogindexpage",
name="theme",
field=models.CharField(
blank=True,
choices=[
("", "None"),
("theme-coral", "Coral"),
("theme-nebuline", "Nebuline"),
("theme-lagoon", "Lagoon"),
("theme-green", "Green"),
],
max_length=25,
),
),
migrations.AlterField(
model_name="blogpage",
name="theme",
field=models.CharField(
blank=True,
choices=[
("", "None"),
("theme-coral", "Coral"),
("theme-nebuline", "Nebuline"),
("theme-lagoon", "Lagoon"),
("theme-green", "Green"),
],
max_length=25,
),
),
]
4 changes: 2 additions & 2 deletions tbx/blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def blog_posts(self):
prefetch_author_images = models.Prefetch(
"authors__author__image",
queryset=CustomImage.objects.prefetch_renditions(
"format-webp|fill-72x72",
"format-webp|fill-100x100",
"format-webp|fill-144x144",
"format-webp|fill-286x286",
),
Expand Down Expand Up @@ -188,7 +188,7 @@ def related_blog_posts(self):
prefetch_author_images = models.Prefetch(
"authors__author__image",
queryset=CustomImage.objects.prefetch_renditions(
"format-webp|fill-72x72",
"format-webp|fill-100x100",
"format-webp|fill-144x144",
"format-webp|fill-286x286",
),
Expand Down
Loading

0 comments on commit 97fc455

Please sign in to comment.