fix: email_detail button (HTMX hx-vals вместо onclick, ломавшего HTML). fix: task_toggle Form-params (Без темы). feat: create_task HTMX-ответ (✅/✗).

This commit is contained in:
2026-10-23 19:36:28 +00:00
parent d94eb5c903
commit 0f0c7ed4db
2 changed files with 9 additions and 2 deletions
+3 -1
View File
@@ -20,7 +20,9 @@
</div>
<div style="display:flex;gap:6px;align-items:center">
<button class="pb-btn" title="Создать задачу в Radicale"
onclick="var b=this;fetch('/api/tasks/create',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({subject:{{ current.meta.get('subject','(без темы)')|tojson|safe }},from:{{ current.meta.get('from','')|tojson|safe }},body:{{ current.body[:300]|tojson|safe }},path:{{ current.path|tojson|safe }}})}).then(r=>r.json()).then(d=>{if(d.ok){b.textContent='✅';b.disabled=true;b.title='Задача создана'}else{alert('Ошибка: '+d.error)}}).catch(e=>alert('Ошибка: '+e));return false">📋</button>
hx-post="/api/tasks/create"
hx-vals='{"subject":{{ (current.meta.get('subject') or '(без темы)')|tojson|safe }},"from":{{ (current.meta.get('from') or '')|tojson|safe }},"body":{{ (current.body or '')[:300]|tojson|safe }},"path":{{ (current.path or '')|tojson|safe }},"email":"{{ (current.meta.get('from') or '')|e }}"}'
hx-swap="outerHTML">📋</button>
<button class="pchev" onclick="this.classList.toggle('open');document.getElementById('phdrs').classList.toggle('open')">⌄</button>
</div>
<div class="phdrs" id="phdrs" style="flex-basis:100%">