Spaces:
Sleeping
Sleeping
Upload create_db.html
Browse files- templates/create_db.html +29 -24
templates/create_db.html
CHANGED
|
@@ -51,26 +51,6 @@
|
|
| 51 |
box-shadow: 0 0 4px #4c4cff;
|
| 52 |
}
|
| 53 |
|
| 54 |
-
.button-spinner {
|
| 55 |
-
display: none;
|
| 56 |
-
border: 2px solid #f5f5f5;
|
| 57 |
-
border-radius: 50%;
|
| 58 |
-
border-top: 2px solid #4c4cff;
|
| 59 |
-
width: 24px;
|
| 60 |
-
height: 24px;
|
| 61 |
-
animation: spin 1s linear infinite;
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
@keyframes spin {
|
| 65 |
-
0% { transform: rotate(0deg); }
|
| 66 |
-
100% { transform: rotate(360deg); }
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
.btn:active .button-spinner {
|
| 70 |
-
display: block;
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
|
| 74 |
.btn-primary {
|
| 75 |
background-color: #4c4cff;
|
| 76 |
border-color: #4c4cff;
|
|
@@ -126,6 +106,22 @@
|
|
| 126 |
align-items: center;
|
| 127 |
height: 100px;
|
| 128 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
</style>
|
| 130 |
|
| 131 |
<div class="container mt-5">
|
|
@@ -148,7 +144,7 @@
|
|
| 148 |
</div>
|
| 149 |
|
| 150 |
<!-- Folder Upload Input -->
|
| 151 |
-
<div id="folder-upload" class="form-group mt-3
|
| 152 |
<label for="folder" class="form-label">Upload Folder</label>
|
| 153 |
<input type="file" id="folder" name="folder" class="form-control" webkitdirectory directory multiple>
|
| 154 |
<small class="text-muted">Note: You can upload a folder containing multiple files.</small>
|
|
@@ -157,15 +153,15 @@
|
|
| 157 |
<!-- Single File Upload Input -->
|
| 158 |
<div id="file-upload" class="form-group mt-3 hidden">
|
| 159 |
<label for="file" class="form-label">Upload Files</label>
|
| 160 |
-
<input type="file" id="file" name="file" class="form-control" multiple
|
| 161 |
<small class="text-muted">Note: You can upload one or more files.</small>
|
| 162 |
</div>
|
| 163 |
|
| 164 |
<!-- Submit Button -->
|
| 165 |
<div class="mt-4 text-center d-flex justify-content-center align-items-center">
|
| 166 |
-
<button type="submit" class="btn btn-primary px-5">
|
| 167 |
<span class="btn-text">Create</span>
|
| 168 |
-
<div class="
|
| 169 |
</button>
|
| 170 |
</div>
|
| 171 |
</form>
|
|
@@ -178,6 +174,8 @@
|
|
| 178 |
const fileLabel = document.getElementById('file-label');
|
| 179 |
const folderUpload = document.getElementById('folder-upload');
|
| 180 |
const fileUpload = document.getElementById('file-upload');
|
|
|
|
|
|
|
| 181 |
|
| 182 |
// Toggle upload mode
|
| 183 |
folderLabel.addEventListener('click', () => {
|
|
@@ -193,6 +191,13 @@
|
|
| 193 |
fileUpload.classList.remove('hidden');
|
| 194 |
folderUpload.classList.add('hidden');
|
| 195 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
</script>
|
| 197 |
|
| 198 |
{% endblock %}
|
|
|
|
| 51 |
box-shadow: 0 0 4px #4c4cff;
|
| 52 |
}
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
.btn-primary {
|
| 55 |
background-color: #4c4cff;
|
| 56 |
border-color: #4c4cff;
|
|
|
|
| 106 |
align-items: center;
|
| 107 |
height: 100px;
|
| 108 |
}
|
| 109 |
+
|
| 110 |
+
.spinner {
|
| 111 |
+
border: 4px solid #f3f3f3; /* Light grey */
|
| 112 |
+
border-top: 4px solid #4c4cff; /* Blue */
|
| 113 |
+
border-radius: 50%;
|
| 114 |
+
width: 24px;
|
| 115 |
+
height: 24px;
|
| 116 |
+
animation: spin 1s linear infinite;
|
| 117 |
+
margin-left: 10px;
|
| 118 |
+
display: none; /* Initially hidden */
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
@keyframes spin {
|
| 122 |
+
0% { transform: rotate(0deg); }
|
| 123 |
+
100% { transform: rotate(360deg); }
|
| 124 |
+
}
|
| 125 |
</style>
|
| 126 |
|
| 127 |
<div class="container mt-5">
|
|
|
|
| 144 |
</div>
|
| 145 |
|
| 146 |
<!-- Folder Upload Input -->
|
| 147 |
+
<div id="folder-upload" class="form-group mt-3">
|
| 148 |
<label for="folder" class="form-label">Upload Folder</label>
|
| 149 |
<input type="file" id="folder" name="folder" class="form-control" webkitdirectory directory multiple>
|
| 150 |
<small class="text-muted">Note: You can upload a folder containing multiple files.</small>
|
|
|
|
| 153 |
<!-- Single File Upload Input -->
|
| 154 |
<div id="file-upload" class="form-group mt-3 hidden">
|
| 155 |
<label for="file" class="form-label">Upload Files</label>
|
| 156 |
+
<input type="file" id="file" name="file" class="form-control" multiple>
|
| 157 |
<small class="text-muted">Note: You can upload one or more files.</small>
|
| 158 |
</div>
|
| 159 |
|
| 160 |
<!-- Submit Button -->
|
| 161 |
<div class="mt-4 text-center d-flex justify-content-center align-items-center">
|
| 162 |
+
<button type="submit" class="btn btn-primary px-5" id="submit-btn">
|
| 163 |
<span class="btn-text">Create</span>
|
| 164 |
+
<div class="spinner" id="spinner"></div>
|
| 165 |
</button>
|
| 166 |
</div>
|
| 167 |
</form>
|
|
|
|
| 174 |
const fileLabel = document.getElementById('file-label');
|
| 175 |
const folderUpload = document.getElementById('folder-upload');
|
| 176 |
const fileUpload = document.getElementById('file-upload');
|
| 177 |
+
const submitBtn = document.getElementById('submit-btn');
|
| 178 |
+
const spinner = document.getElementById('spinner');
|
| 179 |
|
| 180 |
// Toggle upload mode
|
| 181 |
folderLabel.addEventListener('click', () => {
|
|
|
|
| 191 |
fileUpload.classList.remove('hidden');
|
| 192 |
folderUpload.classList.add('hidden');
|
| 193 |
});
|
| 194 |
+
|
| 195 |
+
// Show loader when form is submitted
|
| 196 |
+
document.getElementById('db-form').addEventListener('submit', function(event) {
|
| 197 |
+
// Show the spinner and hide the text
|
| 198 |
+
submitBtn.querySelector('.btn-text').style.display = 'none';
|
| 199 |
+
spinner.style.display = 'inline-block';
|
| 200 |
+
});
|
| 201 |
</script>
|
| 202 |
|
| 203 |
{% endblock %}
|