TCCP illustration cleanup, consolidated image alt text #8270
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the TCCP landing page illustration on narrow screens.
It also does some cleanup from when the illustration was added in #8260.
It consolidates and relocates our Jinja
image_alt_text
tag into a new v1.jinja2tags.images module. It also redefines the default Wagtailimage
tag so that it can optionally take an image dict as its argument instead of always needing to take an Image object.The Wagtail
{% image %}
tag takes an image object and generates an tag in HTML. We use this in various Jinja templates for modules that contain images. And it's very useful when you have an image object:But sometimes we may want to call one of our templates and render an image but don't actually have an Image object, for example if we want to hardcode the image link elements (as we do currently on the home page and on the TCCP landing page). The above code doesn't work well because the
{% image %}
tag can't handle something that isn't actually an Image.This commit thus replaces Wagtail's
{% image %}
with our own{% image %}
that can handle that case; it acts as a passthrough or no-op that simply returns the object that was passed in. That lets you do this:How to test this PR
./frontend.sh
Screenshots
Notes and todos
This resolves a TODO comment from 2020.
Checklist