diff --git a/folkugat_web/api/routes/tema/lyrics.py b/folkugat_web/api/routes/tema/lyrics.py index 556cd5f..392eb17 100644 --- a/folkugat_web/api/routes/tema/lyrics.py +++ b/folkugat_web/api/routes/tema/lyrics.py @@ -33,11 +33,25 @@ def set_lyric( lyric_id: int, title: Annotated[str, Form()], content: Annotated[str, Form()], + max_columns: Annotated[str | None, Form()] = None, ): lyric = lyrics_service.get_lyric_by_id(lyric_id=lyric_id, tema_id=tema_id) if not lyric: raise HTTPException(status_code=404, detail="Could not find lyric!") - new_lyric = lyrics_service.update_lyric(lyric=lyric, title=title, content=content) + + # Parse max_columns from string to int if provided + max_columns_int = None + if max_columns is not None and max_columns.strip(): + try: + max_columns_int = int(max_columns.strip()) + except ValueError: + raise HTTPException(status_code=400, detail="max_columns must be a valid integer") + + try: + new_lyric = lyrics_service.update_lyric(lyric=lyric, title=title, content=content, max_columns=max_columns_int) + except ValueError as e: + raise HTTPException(status_code=400, detail=str(e)) + return lyrics_fragments.lyric(request=request, logged_in=logged_in, lyric=new_lyric) diff --git a/folkugat_web/assets/static/css/main.css b/folkugat_web/assets/static/css/main.css index c96d85a..65cddec 100644 --- a/folkugat_web/assets/static/css/main.css +++ b/folkugat_web/assets/static/css/main.css @@ -737,6 +737,10 @@ video { width: 50%; } +.w-16 { + width: 4rem; +} + .w-full { width: 100%; } diff --git a/folkugat_web/assets/templates/fragments/tema/editor/lyric.html b/folkugat_web/assets/templates/fragments/tema/editor/lyric.html index c754056..5e6d9e4 100644 --- a/folkugat_web/assets/templates/fragments/tema/editor/lyric.html +++ b/folkugat_web/assets/templates/fragments/tema/editor/lyric.html @@ -7,6 +7,16 @@ rounded bg-brown px-2 " /> +