DemocracyClub / dc_django_utils

Shared helpers and utility functions for DC websites
MIT License
0 stars 2 forks source link

Move body tag outside block body_base #40

Closed VirginiaDooley closed 1 year ago

VirginiaDooley commented 1 year ago

Closes https://github.com/DemocracyClub/dc_django_utils/issues/34 Ref https://github.com/DemocracyClub/dc_django_utils/issues/30

symroe commented 1 year ago

I went to test this and found two things:

  1. A problem!
  2. We didn't have any tests for the templates. This feels like a bigger problem, as so many other projects rely on this. I've added some tests that will fail, but will give us some reassurance in future.
symroe commented 1 year ago

In terms of the question about includes...I see what you mean.

I think the solution (not a great one!) is to have

{% block body_raw %}
<body {% block body_attrs %}class="ds-width-full"{% endblock body_attrs %}>
    {% block body_base %}

then projects can extend from body_base, allowing extra_site_js etc to be included. body_raw can be used if the project really wants to control the whole body tag.

Does that work?