Skip to content

Commit

Permalink
Improve upload user experience. (#125)
Browse files Browse the repository at this point in the history
Until user has selected files, keep submit button disabled
and show it as faded.
  • Loading branch information
mcantelon authored May 18, 2023
1 parent 3f321ed commit 39bf89a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion uploader/Transfer/templates/transfer.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h2>Upload Research Data</h2>
<button id="chooserProxy" type="button">Choose directory</button>
<input id="chooser" name="files" type="file" webkitdirectory directory class="collapse" />

<button id="chooserSubmit" type="submit" class="btn btn-primary">Upload</button>
<button id="chooserSubmit" type="submit" class="btn btn-primary opacity-25" disabled="true">Upload</button>
<div id="chooserSpinner" class="spinner-border text-primary invisible" role="status">
<span class="visually-hidden">Loading...</span>
</div>
Expand Down
2 changes: 2 additions & 0 deletions uploader/static/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ $chooserProxy.addEventListener("click", function() {
$chooser.addEventListener("change", function() {
const message = ($chooser.files.length) + " files selected";
$chooserFeedback.textContent = message;
$chooserSubmit.removeAttribute("disabled");
$chooserSubmit.classList.remove("opacity-25");
});

// Hide directory picker, etc., and show spinner when starting upload
Expand Down

0 comments on commit 39bf89a

Please sign in to comment.