]> littlesong.place Git - littlesongplace.git/commitdiff
Minor upload page improvements
authorChris Fulljames <christianfulljames@gmail.com>
Mon, 20 Jan 2025 15:50:40 +0000 (10:50 -0500)
committerChris Fulljames <christianfulljames@gmail.com>
Mon, 20 Jan 2025 15:50:40 +0000 (10:50 -0500)
templates/edit-song.html

index 7dfecec4c363746b47c11e9f5a30f0241559d3c4..63e02b7b93a38ba76e5ef8d3f6083223b8f23454 100644 (file)
@@ -6,10 +6,11 @@
 
 {% if song %}
 <form action="/upload-song?songid={{ song.songid }}" method="post" enctype="multipart/form-data">
+    <h2>Edit Song</h2>
 {% else %}
 <form action="/upload-song" method="post" enctype="multipart/form-data">
+    <h2>Upload a New Song</h2>
 {% endif %}
-    <h2>Upload a new song</h2>
     <div class="upload-form">
         <label for="song">{% if song %}Replace {% endif %}mp3 File</label><br>
         <input type="file" name="song" accept=".mp3" id="file-select" {% if not song %}required{% endif %}>
         <input type="text" name="collabs" placeholder="@fren_user, John Doe, ..." value="{{ ", ".join(song.collaborators) }}" maxlength="350">
     </div>
     <div class="upload-form">
-        <input type="submit" value="Upload">
+        {% if song %}
+        <input type="submit" value="Update" onclick="onUpload(event)">
+        {% else %}
+        <input type="submit" value="Upload" onclick="onUpload(event)">
+        {% endif %}
+        <p id="uploading" hidden>uploading...</p>
     </div>
 </form>
 
@@ -44,6 +50,11 @@ document.getElementById("file-select").addEventListener("change", function(e) {
         songTitle.value = name.substring(0, name.length - 4);
     }
 });
+
+function onUpload(event) {
+    var uploading = document.getElementById("uploading")
+    uploading.hidden = false;
+}
 </script>
 
 {% endblock %}