albums: support custom album titles
This commit is contained in:
parent
660038b897
commit
7407353dfb
@ -212,10 +212,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="contented-upload-if contented-if-album">
|
<div class="contented-upload-if contented-if-album">
|
||||||
<label>
|
<input type="text" class="contented-album-title" placeholder="Album name"><br>
|
||||||
Type a list of short IDs, separated with commas:<br>
|
<input type="text" class="contented-album-items" placeholder="Image IDs, separated with commas">
|
||||||
<input class="contented-album-input" type="text">
|
|
||||||
</label>
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<button class="contented-album-upload">Make album »</button>
|
<button class="contented-album-upload">Make album »</button>
|
||||||
</div>
|
</div>
|
||||||
@ -328,7 +326,12 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
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) {
|
for (var i = 0; i < childIDs.length; ++i) {
|
||||||
childIDs[i] = childIDs[i].trim(); // Basic validation - can't really perform full validation here
|
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'});
|
var blob = new Blob([JSON.stringify(childIDs)], {type : 'contented/album'});
|
||||||
handleUploadFrom([blob]);
|
handleUploadFrom([new File([blob], title, {type: 'contented/album'})]);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ctrl+V uploads
|
// Ctrl+V uploads
|
||||||
@ -484,6 +487,10 @@
|
|||||||
|
|
||||||
// Common upload handler
|
// Common upload handler
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {File[]|Blob[]} files
|
||||||
|
*/
|
||||||
var handleUploadFrom = function(files) {
|
var handleUploadFrom = function(files) {
|
||||||
|
|
||||||
setProgressCaption("Uploading, please wait...");
|
setProgressCaption("Uploading, please wait...");
|
||||||
|
Loading…
Reference in New Issue
Block a user