From aacd95012e191768e95a2b4f665443661ff96557 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sat, 9 May 2026 01:37:29 +0200 Subject: [PATCH] =?UTF-8?q?feat(l4d2-web):=20blueprint=20rename=20moves=20?= =?UTF-8?q?to=20footer=20modal=20=E2=80=94=20matches=20overlay/server=20pa?= =?UTF-8?q?ttern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drops the inline Name input from the blueprint edit form. A Rename link sits next to Delete in the page footer; clicking opens a one-line modal that posts to a new POST /blueprints//rename route. The main edit form keeps the current name as a hidden input so its full Save still works unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- l4d2web/routes/blueprint_routes.py | 23 +++++++++++++++++++++++ l4d2web/templates/blueprint_detail.html | 17 ++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/l4d2web/routes/blueprint_routes.py b/l4d2web/routes/blueprint_routes.py index b68b63a..97f4ebf 100644 --- a/l4d2web/routes/blueprint_routes.py +++ b/l4d2web/routes/blueprint_routes.py @@ -142,6 +142,29 @@ def update_blueprint_form(blueprint_id: int) -> Response: return redirect(f"/blueprints/{blueprint_id}") +@bp.post("/blueprints//rename") +@require_login +def rename_blueprint(blueprint_id: int) -> Response: + user = current_user() + assert user is not None + name = request.form.get("name", "").strip() + if not name: + return Response("name is required", status=400) + + with session_scope() as db: + blueprint = db.scalar( + select(BlueprintModel).where( + BlueprintModel.id == blueprint_id, + BlueprintModel.user_id == user.id, + ) + ) + if blueprint is None: + return Response(status=404) + blueprint.name = name + + return redirect(f"/blueprints/{blueprint_id}") + + def _delete_blueprint(db, user_id: int, blueprint_id: int) -> Response | None: blueprint = db.scalar( select(BlueprintModel).where( diff --git a/l4d2web/templates/blueprint_detail.html b/l4d2web/templates/blueprint_detail.html index 88fb05f..ad0645c 100644 --- a/l4d2web/templates/blueprint_detail.html +++ b/l4d2web/templates/blueprint_detail.html @@ -9,7 +9,7 @@
- + Overlays
@@ -58,8 +58,23 @@ + + + + +