diff --git a/public/assets/js/claimPublish.js b/public/assets/js/claimPublish.js index 96952337..6901cbd4 100644 --- a/public/assets/js/claimPublish.js +++ b/public/assets/js/claimPublish.js @@ -27,6 +27,7 @@ function previewAndStageFile(selectedFile){ var preview = document.getElementById('image-preview'); var dropzone = document.getElementById('drop-zone'); var previewReader = new FileReader(); + var nameInput = document.getElementById('publish-name'); preview.style.display = 'block'; dropzone.style.display = 'none'; @@ -36,9 +37,10 @@ function previewAndStageFile(selectedFile){ }; if (selectedFile) { - console.log(selectedFile); previewReader.readAsDataURL(selectedFile); // reads the data and sets the img src - document.getElementById('publish-name').value = selectedFile.name.substring(0, selectedFile.name.indexOf('.')); // updates metadata inputs + if (nameInput.value === "") { + nameInput.value = selectedFile.name.substring(0, selectedFile.name.indexOf('.')); + } stagedFiles = [selectedFile]; // stores the selected file for upload } else { preview.src = ''; diff --git a/views/partials/publish.handlebars b/views/partials/publish.handlebars index 93d050e9..c143d265 100644 --- a/views/partials/publish.handlebars +++ b/views/partials/publish.handlebars @@ -10,7 +10,7 @@