Skip to content

Remove slippers#1194

Draft
rebkwok wants to merge 5 commits into
mainfrom
remove-slippers
Draft

Remove slippers#1194
rebkwok wants to merge 5 commits into
mainfrom
remove-slippers

Conversation

@rebkwok
Copy link
Copy Markdown
Contributor

@rebkwok rebkwok commented May 18, 2026

An experiment, don't merge this

rebkwok and others added 5 commits May 14, 2026 15:59
Slippers stops working under Django 6.0 (variable names can no longer contain
hyphens, which breaks Slippers' {% attrs %} tag) and pulling in a workaround
just to keep a vendored library alive isn't worth it. Drop Slippers entirely
and provide the small subset of functionality we actually use as a custom
template tag library.

New template builtins (airlock/templatetags/template_components.py):

- {% component "path.html" with key=value ... %}body{% endcomponent %}
  replaces the {% #component %}...{% /component %} block syntax. The inner
  content is rendered once and stashed under a sentinel context key; the
  component template renders it via {% body %}. {% body %} reads only the
  topmost context dict so an outer component's body never leaks into a
  nested {% include %} that doesn't push its own body.
- {% attrs name1 name2 name3=expr %} replaces Slippers' attrs tag, looking
  up positional args in the include's pushed extra_context only. Without
  this restriction, outer-scope variables like a Django Form bound to
  `form` would leak in and end up rendered as HTML attributes.
- {% setvar name=value %} replaces Slippers' {% var %} tag.
- {% fragment as varname %}...{% endfragment %} captures rendered HTML into
  a named variable, for callers that need to pass HTML through a kwarg
  (e.g. a card's custom_button slot).

The {% component %} tag is the main simplification: with it, callers no
longer need to declare uniquely-named {% partialdef %} blocks and reference
them by hard-coded "template_path.html#partial_name" strings, and component
templates no longer need a setvar-based prelude to stop the partial-name
string from leaking down into nested includes. The `label` parameter on
button/code/list-group-item is gone too — the body slot replaces it.

Settings:

- Drop "slippers" from INSTALLED_APPS.
- Drop the slippers + airlock_components template builtins; add the new
  template_components builtin.
- Update MissingVariableErrorFilter to walk the exception traceback for the
  actual template name. In Django 6.0 context.template_name is the top-level
  template, so the existing _components/_partials prefix check missed
  included templates entirely.

Pyproject:

- Drop slippers dependency and the exclude_blocks coverage workaround.

Multi-slot components (card, modal) keep a small {% setvar local_X=X %} +
{% setvar X="" %} prelude for their non-body slot variables (custom_button,
button), since those are still passed as ordinary kwargs and would otherwise
inherit from outer context.

Deletions (unused vendor code from the original job-server import):

- assets.views / assets.base_views / assets.test_components and the
  /ui-components/ gallery URL.
- Unused upstream component templates: gallery, header, footer, breadcrumbs,
  multiselect, skip-link, grid, timeline-item, time, log-item, table/*,
  pill/{application,project}-status, form/{fieldset,legend}.
- Unused partials: card-pagination, latest-job-requests-table, staff-hero.
- assets/templates/components.yaml and airlock/templatetags/airlock_components.py.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants