diff --git a/less/pages/import.less b/less/pages/import.less index 52ab735..edefa35 100644 --- a/less/pages/import.less +++ b/less/pages/import.less @@ -1,18 +1,18 @@ form.import-form { display: flex; flex-direction: column; align-items: center; &span.row { justify-content: space-around; } - + input[type=file] { width: 100%; align-self: center; } - + input[type=submit] { width: 100%; margin-top: .5rem; } } \ No newline at end of file diff --git a/static/js/import.js b/static/js/import.js index efe1959..9e6b460 100644 --- a/static/js/import.js +++ b/static/js/import.js @@ -1,49 +1,49 @@ const selectElem = document.querySelector('select[name="collection"]'); const submitElem = document.querySelector('input[type="submit"]'); const zipInfo = document.querySelector('span.zip > ul.info'); const zipWarning = document.querySelector('span.zip > p.error'); const fileInput = document.querySelector('input[type="file"]') document.onreadystatechange = () => { if ( document.readyState === "complete") { - selectElem.disabled = true; + selectElem.disabled = true; submitElem.disabled = true; zipInfo.hidden = true; zipWarning.hidden = true; } } fileInput.onchange = function() { if ( this.files.length === 1 ) { if ( this.files[0].type === 'application/zip' ) { selectElem.disabled = true; submitElem.disabled = false; zipInfo.hidden = false; zipWarning.hidden = true; } else if ( this.files[0].type.match('text.*')) { selectElem.disabled = false; submitElem.disabled = false; zipInfo.hidden = true; zipWarning.hidden = true; } } - + if ( this.files.length > 1 ) { selectElem.disabled = false; submitElem.disabled = false; var zips = 0; Array.from(this.files).forEach(file => { if ( file.name.endsWith(".zip") ) { zips++; } }) if ( zips > 0 ) { zipInfo.hidden = true; zipWarning.hidden = false; } else { zipInfo.hidden = true; zipWarning.hidden = true; } } } \ No newline at end of file