Four changes to the forms people write in. **The title is optional**, and says nothing about it: a field labelled «(opcional)» is a field asking to be filled in. An untitled post is «Sin Título» and the next is «Sin Título 2», so a list of them can still be told apart and linked to. apps/board/titles.py holds the rule. The numbering is done per place, against what is already there. The wall and the queue count every title in the table, deleted rows included — a number that comes back is a thread that looks like one somebody remembers reading. A public post counts the *filenames* in its folder instead, because that is what collides in a repository: two untitled posts on one day would both be `<fecha>-sin-titulo.es.md`, and the second would have failed as "somebody else saved this file while you were editing it", which is a message about a conflict that never happened. Clearing the title on an edit excludes the file being edited from its own check, so saving three times does not rename it three times. **The event box folds away.** Most posts are not events, and three date pickers between the title and the text are three fields most people scroll past. A <details>, like the account menu, so no script is involved; it opens by itself when the post already has a date. **The AI disclosure is a switch** rather than a checkbox — what it says is a statement about the text, not a detail of the form, and it should look like something that is on or off. Drawn entirely from the checkbox's own :checked state: under a policy with no 'unsafe-inline' a control that needs a script is a control that silently does nothing. The input stays in the tab order and keeps its label, so it works from a keyboard, and it is anchored inside its own label rather than left adrift over the page. **Cancelar is a button**, and Vista previa beside it is shaped the same: leaving is the other half of a decision and should be the same size as the half next to it. Quiet rather than filled, so the eye still knows which one publishes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
89 lines
4.3 KiB
HTML
89 lines
4.3 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}{{ 'Editar propuesta' if item else 'Proponer una publicación' }}{% endblock %}
|
|
|
|
{% block main %}
|
|
<div class="feed-head">
|
|
<h1>{{ 'Editar propuesta' if item else 'Proponer una publicación' }}</h1>
|
|
</div>
|
|
|
|
<p class="muted">
|
|
Esto no es el muro: va a vienalatina.com, en español, y se traduce solo al
|
|
alemán y al portugués. Un moderador lo lee antes de que salga.
|
|
</p>
|
|
|
|
<form class="card" method="post" enctype="multipart/form-data"
|
|
action="{{ url_for('submissions.edit', submission_id=item.id) if item else url_for('submissions.propose') }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<label for="title">Título</label>
|
|
<input id="title" name="title" type="text" maxlength="140"
|
|
value="{{ fields.title if fields else '' }}">
|
|
|
|
<label for="description">Resumen <span class="muted small">(opcional)</span></label>
|
|
<input id="description" name="description" type="text" maxlength="300"
|
|
value="{{ fields.description if fields else '' }}">
|
|
<p class="muted small">Una o dos líneas: es lo que se ve en los listados.</p>
|
|
|
|
{# An event's own date, which is not the day the post goes up. The date is
|
|
also what makes this an event: there is nothing to tick first, so there is
|
|
no way to say "this is an event" and then not say when. #}
|
|
{#- A fold rather than a fieldset: most posts are not events, and six
|
|
inches of date pickers between the title and the text is six inches
|
|
most people scroll past. Open by itself when the post already has a
|
|
date, so editing an event does not hide the thing being edited. -#}
|
|
<details class="fold" {{ 'open' if fields.event_date }}>
|
|
<summary>Si es un evento <span class="muted small">(fecha, hora, lugar)</span></summary>
|
|
<p class="muted small">
|
|
Pon la fecha y será un evento: aparecerá en la agenda del sitio, con el
|
|
día y el lugar destacados. Déjala vacía y es un artículo normal.
|
|
</p>
|
|
|
|
<label for="event_date">Fecha del evento</label>
|
|
<input id="event_date" name="event_date" type="date" value="{{ fields.event_date or '' }}">
|
|
|
|
<label for="event_time">Hora <span class="muted small">(opcional)</span></label>
|
|
<input id="event_time" name="event_time" type="time" value="{{ fields.event_time or '' }}">
|
|
<p class="muted small">Déjala vacía si dura todo el día.</p>
|
|
|
|
<label for="event_location">Lugar <span class="muted small">(opcional)</span></label>
|
|
<input id="event_location" name="event_location" maxlength="200"
|
|
value="{{ fields.event_location or '' }}">
|
|
<p class="muted small">Dónde es: el sitio, la calle, el barrio.</p>
|
|
</details>
|
|
|
|
<label for="body">Texto</label>
|
|
<textarea id="body" data-markdown data-rich="full" name="body" rows="16" required
|
|
placeholder="Se puede usar Markdown: **negrita**, ## títulos, listas, enlaces.">{{ fields.body if fields else '' }}</textarea>
|
|
{#- The stored markdown, rendered by the server for the editor to adopt.
|
|
There is no markdown parser in the browser: this is how the box can
|
|
show the formatting without a second opinion about what somebody's
|
|
text means. Ignored entirely when scripting is off. -#}
|
|
<template data-rich-html="body">{{ to_html(fields.body if fields else '', breaks=False) }}</template>
|
|
|
|
<label for="picture">Imagen <span class="muted small">(opcional)</span></label>
|
|
<input id="picture" name="picture" type="file" accept="image/*">
|
|
{% if item and item.photo_name %}
|
|
<p class="muted small">
|
|
Ya tiene una imagen. Si eliges otra, la sustituye.
|
|
</p>
|
|
{% endif %}
|
|
|
|
<div class="actions">
|
|
<button class="btn" type="submit">{{ 'Guardar' if item else 'Enviar a revisión' }}</button>
|
|
{#- Beside the button that publishes, because that is the moment it is
|
|
answered. One line rather than a fieldset: it has to be seen, not
|
|
to take up the form. -#}
|
|
<label class="toggle">
|
|
<input type="checkbox" name="ai_generated" {{ 'checked' if (fields.ai_generated if fields else False) }}>
|
|
{#- The switch itself is drawn by board.css from the checkbox's own
|
|
state. No script: a control that needs one is a control that
|
|
does nothing under this Content-Security-Policy. -#}
|
|
<span class="toggle__track" aria-hidden="true"></span>
|
|
<span class="toggle__text">Contenido generado con IA</span>
|
|
</label>
|
|
|
|
<a class="btn btn--quiet" href="{{ url_for('submissions.index') }}">Cancelar</a>
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|