vienalatina/apps/board/templates/gestion.html
Pablo Volenski 7e70004e7b
Marca: the admin owns the look, logo included
The brand colours were two identical `:root` blocks — one in the theme, one in
the members area's stylesheet — with a comment in the second reading *"If the
brand colours change, change them in both."* There was no logo anywhere, no
favicon in either `<head>`, and `params.defaultImage` was the empty string with
a comment saying it was waiting for one. Every one of those was a change only
somebody with the repository could make.

`brand.FACTORY` is the single source of truth for the palette now, and
`test_brand.py` parses both stylesheets and fails the build if either drifts
from it. That is what retires the comment: not by merging the two files — they
are served by different things and each has to stand alone — but by making a
divergence fail a test instead of going unnoticed for a month.

**Gestión → Marca**, admins only, saves to two places in one submit, because
the two halves of the site cannot read the same store: SQLite for the members
area, which must render when the git server is down, and `data/brand.yaml` plus
`static/brand/` in the content repository for the public site, which is files
on disk. SQLite is written first and the commits follow — if Gitea is
unreachable the change still takes effect here, `published_at` stays NULL, and
the screen offers to try the publish again. The other order would let a git
outage block a change that does not need git.

The easy half is six colour pickers, each with the name of what it changes, and
a live preview of the real chrome. The three brand shades are worked out from
the brand colour in HLS, so one picked colour gives a coherent set rather than
one red button on an orange background; scaling RGB towards white would have
washed the hue out. A WCAG contrast warning names any pair that will be hard to
read, with its ratio, and saves it anyway: an admin may have a reason, and what
this prevents is shipping an unreadable site without once being told.

The advanced half, behind a fold, is every token as a text field and a free CSS
box appended last so it wins. **The Marca screen deliberately does not load the
generated stylesheet** — every other page does — which is what keeps *Restaurar
lo de fábrica* reachable after somebody writes `* { display: none }` into that
box, and the reason the colours an admin picks do not show on the page where
they pick them. The preview block is where they do.

Only differences from the factory are stored, so a token added later arrives
with its default already in place for every existing install. Both halves serve
a generated stylesheet rather than an inline `<style>`, because the CSP has no
'unsafe-inline' and an inline block would simply not apply.

The logo also fills the gap phase I left: it is the share-card fallback and the
`Organization` logo, ahead of `defaultImage`, and the home page carries
`og:image` for the first time — the front page of the site was the last place
that should share as a bare link.

No SVG and no ICO: the logo takes PNG, JPG or WebP and the favicon PNG, both
identified from their bytes by the sniffer the wall already uses. An SVG is XML
that can carry script and would be served from our own origin.

A new table, so `CREATE TABLE IF NOT EXISTS` is enough and no migration is
involved. `FakeRepo` moved from test_content.py into conftest.py, since two
features commit to the content repository now. Verified by building with Hugo
0.135.0 and the pipeline's flags both ways: with a brand.yaml the second
stylesheet, the favicon and the logo appear, and without one the output is
byte-for-byte identical to the build before any of this existed.

545 tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-10-03 20:25:52 +00:00

81 lines
2.7 KiB
HTML

{% extends "base.html" %}
{% block title %}Gestión{% endblock %}
{% block main %}
<div class="feed-head">
<h1>Gestión</h1>
</div>
<p class="muted">
Lo que sólo hace la administración. Todo lo demás — el muro, los privados,
las publicaciones — está en las otras secciones y funciona igual para ti que
para cualquier miembro.
</p>
<section class="panel">
<div class="panel__head">
<h2>Miembros</h2>
<a class="linkish" href="{{ url_for('members.new') }}">Dar de alta</a>
</div>
<p class="panel__row">
{{ counts.members }} en total · {{ counts.moderators }} pueden moderar
{% if counts.suspended %} · {{ counts.suspended }} suspendido{{ '' if counts.suspended == 1 else 's' }}{% endif %}
</p>
<p class="muted small">
El directorio está en <a href="{{ url_for('members.index') }}">Miembros</a>,
que ahora es una sección como las demás. Invitar de nuevo, cambiar el rol,
suspender y eliminar están en la ficha de cada persona.
</p>
</section>
<section class="panel">
<div class="panel__head">
<h2>Artículos publicados</h2>
<a class="linkish" href="{{ url_for('content.index', collection='post') }}">Abrir</a>
</div>
<p class="muted small">
Lo que ya está en vienalatina.com: editar, corregir o retirar. Para
publicar algo nuevo, o para revisar lo que proponen los miembros, está
<a href="{{ url_for('submissions.index') }}">Publicaciones</a>.
</p>
</section>
<section class="panel">
<div class="panel__head">
<h2>Páginas del sitio</h2>
<a class="linkish" href="{{ url_for('content.index', collection='page') }}">Abrir</a>
</div>
<p class="muted small">
Acerca de, contacto y las demás páginas fijas de vienalatina.com. Las
publicaciones no están aquí: eso es
<a href="{{ url_for('submissions.index') }}">Publicaciones</a>, que los
moderadores comparten contigo.
</p>
</section>
<section class="panel">
<div class="panel__head">
<h2>Marca</h2>
<a class="linkish" href="{{ url_for('brand.edit') }}">Abrir</a>
</div>
{% if brand.updated_at and not brand.published_at %}
<p class="panel__row">Hay cambios guardados que no han llegado al sitio público.</p>
{% endif %}
<p class="muted small">
Los colores, el logotipo y el icono de la pestaña, para las dos mitades del
sitio. Con un apartado avanzado para quien sepa CSS, y un botón para
volver a lo de fábrica.
</p>
</section>
{% if counts.pending %}
<section class="panel panel--attention">
<div class="panel__head">
<h2>Pendiente de revisar</h2>
<a class="linkish" href="{{ url_for('submissions.index') }}">Ver</a>
</div>
<p class="panel__row">{{ counts.pending }} propuesta{{ '' if counts.pending == 1 else 's' }} esperando a un moderador.</p>
</section>
{% endif %}
{% endblock %}