From c1cbd4bc46f9b1098d5dcb73f4d5ae15673d6754 Mon Sep 17 00:00:00 2001 From: hermes Date: Sat, 24 Oct 2026 06:15:13 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20inline=20edit=20=E2=80=94=20click=20tas?= =?UTF-8?q?k=20name=20=E2=86=92=20Alpine=20input=20=E2=86=92=20Enter=20sav?= =?UTF-8?q?es=20via=20PUT=20/api/task/{uid}/update.=20fix:=20app.py=20inde?= =?UTF-8?q?ntation,=20CSS=20add-task/t-edit-wrap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hermes/scratch/fix_indent2.py | 18 ++++++++++++++++++ webui/app.py | 23 ++++++++++++++++------- webui/static/css/app.css | 3 +++ 3 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 .hermes/scratch/fix_indent2.py diff --git a/.hermes/scratch/fix_indent2.py b/.hermes/scratch/fix_indent2.py new file mode 100644 index 0000000..22ae4c5 --- /dev/null +++ b/.hermes/scratch/fix_indent2.py @@ -0,0 +1,18 @@ +"""Fix indentation of lines 379-381 in app.py.""" +path = "webui/app.py" +with open(path) as f: + lines = f.readlines() + +# Fix lines 379-381: remove 8 leading spaces (they have 16, should have 8) +for i in range(378, 382): # 0-indexed: 378 = line 379 + if i < len(lines): + stripped = lines[i].lstrip() + current_indent = len(lines[i]) - len(stripped) + if current_indent == 16: + lines[i] = " " * 8 + stripped + +with open(path, "w") as f: + f.writelines(lines) + +compile(open(path).read(), path, 'exec') +print("OK") \ No newline at end of file diff --git a/webui/app.py b/webui/app.py index 447984d..26e8b67 100644 --- a/webui/app.py +++ b/webui/app.py @@ -371,22 +371,31 @@ def task_toggle(uid: str, request: Request, _: AuthDep, @app.get("/api/tasks/reload") def tasks_reload(request: Request, _: AuthDep): """HTMX-фрагмент: весь блок задач для главной (создание + инлайн-редактирование).""" + import json as _json tasks = radicale.get_tasks() items = [] for t in tasks: due_html = f'
срок {t["due"]}
' if t.get("due") else "" - items.append(f'''
- -
-
{t['summary']}
- {due_html} + sid = _json.dumps(t["summary"], ensure_ascii=False) + xdata = '{{edit:{},editing:false}}'.format(sid) + items.append(f'''
+ +
+
{t['summary']}
+ + {due_html} +
+
''') items_html = "".join(items) or '
Задач нет или Radicale недоступен
' active = sum(1 for t in tasks if not t["completed"]) btn = '' html = f'''
✅ Текущие задачи {active}
-
{items_html}{btn}
''' +
+{items_html}{btn}
''' return HTMLResponse(html) diff --git a/webui/static/css/app.css b/webui/static/css/app.css index 021cb84..18da086 100644 --- a/webui/static/css/app.css +++ b/webui/static/css/app.css @@ -198,6 +198,9 @@ body.f3 .c3{flex:1} .pb-btn{background:none;border:1px solid var(--border);color:var(--fg);cursor:pointer;font-size:16px;padding:3px 8px;border-radius:6px;line-height:1} .pb-btn:hover{background:var(--hover);border-color:var(--accent)} .pb-btn:disabled{opacity:0.4;cursor:default} +.add-task{background:none;border:1px dashed var(--fg3);color:var(--fg2);cursor:pointer;font-size:12px;padding:6px 14px;border-radius:6px;margin:6px 10px;width:calc(100% - 20px)} +.add-task:hover{border-color:var(--accent);color:var(--fg)} +.t-edit-wrap input{width:100%;padding:2px 4px;border:1px solid var(--accent);border-radius:4px;background:var(--bg);color:var(--fg);font:inherit;font-size:12.5px} .em{display:flex;gap:8px;padding:8px 14px;border-bottom:1px solid var(--border); cursor:pointer;align-items:flex-start}