From 7407353dfb979a991de6a3db43f8a6bc193f7e40 Mon Sep 17 00:00:00 2001 From: mappu Date: Wed, 17 May 2023 19:21:48 +1200 Subject: [PATCH] albums: support custom album titles --- static/sdk.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/static/sdk.js b/static/sdk.js index bee2cba..9981308 100644 --- a/static/sdk.js +++ b/static/sdk.js @@ -212,10 +212,8 @@
- +
+

@@ -328,7 +326,12 @@ e.preventDefault(); e.stopPropagation(); - var childIDs = $(".contented-album-input").val().split(","); + var title = $(".contented-album-title").val(); + if (title === "") { + title = "Untitled album"; + } + + var childIDs = $(".contented-album-items").val().split(","); for (var i = 0; i < childIDs.length; ++i) { childIDs[i] = childIDs[i].trim(); // Basic validation - can't really perform full validation here @@ -345,7 +348,7 @@ } var blob = new Blob([JSON.stringify(childIDs)], {type : 'contented/album'}); - handleUploadFrom([blob]); + handleUploadFrom([new File([blob], title, {type: 'contented/album'})]); }); // Ctrl+V uploads @@ -484,6 +487,10 @@ // Common upload handler + /** + * + * @param {File[]|Blob[]} files + */ var handleUploadFrom = function(files) { setProgressCaption("Uploading, please wait...");