From 3aadb815b49e8272a9f5bc5106bcbe876fa5dfc7 Mon Sep 17 00:00:00 2001 From: Chris Fulljames Date: Sun, 23 Feb 2025 08:33:05 -0500 Subject: [PATCH] Use icons in more places, revamp song page --- main.py | 12 ++- static/lsp_btn_add02.gif | Bin 0 -> 169 bytes static/styles.css | 5 +- templates/playlist.html | 4 +- templates/profile.html | 6 +- templates/song-list.html | 149 ++----------------------------------- templates/song-macros.html | 139 ++++++++++++++++++++++++++++++++++ templates/song.html | 20 ++++- test/test_offline.py | 4 +- todo.txt | 2 + 10 files changed, 186 insertions(+), 155 deletions(-) create mode 100644 static/lsp_btn_add02.gif create mode 100644 templates/song-macros.html diff --git a/main.py b/main.py index 5e81a87..5210658 100644 --- a/main.py +++ b/main.py @@ -287,10 +287,11 @@ def upload_song(): if not "userid" in session: return redirect("/login") # Must be logged in to edit + userid = session["userid"] + error = validate_song_form() if not error: - userid = session["userid"] if "songid" in request.args: error = update_song() else: @@ -299,7 +300,12 @@ def upload_song(): if not error: username = session["username"] app.logger.info(f"{username} uploaded/modified a song") - return redirect(f"/users/{username}") + if "songid" in request.args: + # After editing an existing song, go back to song page + return redirect(f"/song/{userid}/{request.args['songid']}?action=view") + else: + # After creating a new song, go back to profile + return redirect(f"/users/{username}") else: username = session["username"] @@ -525,7 +531,7 @@ def delete_song(songid): app.logger.info(f"{session['username']} deleted song: {song_data['title']}") flash_and_log(f"Deleted '{song_data['title']}'", "success") - return redirect(request.referrer) + return redirect(f"/users/{session['username']}") @app.get("/song//") def song(userid, songid): diff --git a/static/lsp_btn_add02.gif b/static/lsp_btn_add02.gif new file mode 100644 index 0000000000000000000000000000000000000000..38ec190c795d89fea1d6b967cc9db4c9636e9068 GIT binary patch literal 169 zcmZ?wbh9u|6krfwSi}GVFP?3kT)c8m!}{LShrj|LLh(PhpKD04vtxj(k)8oFBS`2c z3#Sf{p#zc!X=h+ome_SiPO0nqlO?Ag>1@B$r`jdY(mU63p{BLn1F>Y|(8DX+Rl)j1 dfLieCyPr`fkmB}~D{SufB;!!~?blTptO2{{ username }}< {% if session["userid"] == userid -%}

- -Delete + +