fix(contacts): строки были 9 px — tojson ломал x-data в атрибуте

Корень: `x-data="{edit:false, val:{{ value|tojson }}, err:''}"` — tojson вставляет
строку в двойных кавычках, атрибут тоже в двойных → `val:""` обрывал атрибут,
Alpine не инициализировал компонент, <span x-show="!edit"> оставался display:none,
ячейки визуально пустые, высота строки = padding + border = 9 px.

- `|tojson|forceescape` в макросе ячейки и в onclick кнопки задачи карточки.
- Плотность строк: td padding 8px 10px, line-height 1.35, min-height 34px,
  заголовки 9px 10px → высота строки 9 → 34 px.
- Регресс-тест test_inline_edit_xdata_is_valid_html (в разметке не должно быть
  x-data="{edit:false, val:" — ловит класс ошибки, не одну страницу).

Проверено headless-Chromium (метрики из DOM): было rowH=9, spanDisp=none;
стало rowH=34, spanDisp=block, valH=17. tests/test_contacts_ui.py — 17/17.
Контейнер пересобран (healthy): x-data экранирован, 7 строк на букве «А».
This commit is contained in:
2026-10-30 07:14:05 +00:00
parent f41d00cecb
commit 664f038d28
6 changed files with 60 additions and 5 deletions
@@ -1,5 +1,5 @@
{% macro edit_value(contact, field) -%}
<div class="ed" x-data="{edit:false, val:{{ (contact.get(field) or '')|tojson }}, err:''}">
<div class="ed" x-data="{edit:false, val:{{ (contact.get(field) or '')|tojson|forceescape }}, err:''}">
<span class="cellv" x-show="!edit" x-on:click.stop="edit=true"
title="{{ contact.get(field) or '—' }} — клик, чтобы изменить">{{ contact.get(field) or '—' }}</span>
<template x-if="edit">
+1 -1
View File
@@ -14,7 +14,7 @@
</div>
</div>
<button class="pb-btn" title="Создать задачу из переписки с контактом"
onclick="CTTask(this, {{ (current.get('id') or '')|tojson }})">📋</button>
onclick="CTTask(this, {{ (current.get('id') or '')|tojson|forceescape }})">📋</button>
</div>
<div class="cfields">