Spaces:
Sleeping
Sleeping
Update templates/create_db.html
Browse files- templates/create_db.html +43 -1
templates/create_db.html
CHANGED
|
@@ -57,6 +57,7 @@
|
|
| 57 |
display: flex;
|
| 58 |
justify-content: center;
|
| 59 |
align-items: center;
|
|
|
|
| 60 |
}
|
| 61 |
|
| 62 |
.btn-primary:hover {
|
|
@@ -101,6 +102,33 @@
|
|
| 101 |
align-items: center;
|
| 102 |
height: 100px;
|
| 103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
</style>
|
| 105 |
|
| 106 |
<div class="container mt-5">
|
|
@@ -138,7 +166,7 @@
|
|
| 138 |
|
| 139 |
<!-- Submit Button -->
|
| 140 |
<div class="mt-4 text-center d-flex justify-content-center align-items-center">
|
| 141 |
-
<button type="submit" class="btn btn-primary px-5">
|
| 142 |
<span class="btn-text">Create</span>
|
| 143 |
<div class="button-spinner"></div>
|
| 144 |
</button>
|
|
@@ -153,6 +181,8 @@
|
|
| 153 |
const fileLabel = document.getElementById('file-label');
|
| 154 |
const folderUpload = document.getElementById('folder-upload');
|
| 155 |
const fileUpload = document.getElementById('file-upload');
|
|
|
|
|
|
|
| 156 |
|
| 157 |
// Toggle upload mode
|
| 158 |
folderLabel.addEventListener('click', () => {
|
|
@@ -168,6 +198,18 @@
|
|
| 168 |
fileUpload.classList.remove('hidden');
|
| 169 |
folderUpload.classList.add('hidden');
|
| 170 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
</script>
|
| 172 |
|
| 173 |
{% endblock %}
|
|
|
|
| 57 |
display: flex;
|
| 58 |
justify-content: center;
|
| 59 |
align-items: center;
|
| 60 |
+
position: relative;
|
| 61 |
}
|
| 62 |
|
| 63 |
.btn-primary:hover {
|
|
|
|
| 102 |
align-items: center;
|
| 103 |
height: 100px;
|
| 104 |
}
|
| 105 |
+
|
| 106 |
+
/* Spinner style */
|
| 107 |
+
.button-spinner {
|
| 108 |
+
position: absolute;
|
| 109 |
+
width: 24px;
|
| 110 |
+
height: 24px;
|
| 111 |
+
border: 4px solid #f5f5f5;
|
| 112 |
+
border-top: 4px solid #4c4cff;
|
| 113 |
+
border-radius: 50%;
|
| 114 |
+
animation: spin 1s linear infinite;
|
| 115 |
+
display: none;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/* Animation for the spinner */
|
| 119 |
+
@keyframes spin {
|
| 120 |
+
0% { transform: rotate(0deg); }
|
| 121 |
+
100% { transform: rotate(360deg); }
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
/* Hide spinner when not loading */
|
| 125 |
+
.btn-loading .button-spinner {
|
| 126 |
+
display: inline-block;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.btn-loading .btn-text {
|
| 130 |
+
display: none;
|
| 131 |
+
}
|
| 132 |
</style>
|
| 133 |
|
| 134 |
<div class="container mt-5">
|
|
|
|
| 166 |
|
| 167 |
<!-- Submit Button -->
|
| 168 |
<div class="mt-4 text-center d-flex justify-content-center align-items-center">
|
| 169 |
+
<button type="submit" class="btn btn-primary px-5" id="submit-button">
|
| 170 |
<span class="btn-text">Create</span>
|
| 171 |
<div class="button-spinner"></div>
|
| 172 |
</button>
|
|
|
|
| 181 |
const fileLabel = document.getElementById('file-label');
|
| 182 |
const folderUpload = document.getElementById('folder-upload');
|
| 183 |
const fileUpload = document.getElementById('file-upload');
|
| 184 |
+
const submitButton = document.getElementById('submit-button');
|
| 185 |
+
const buttonSpinner = submitButton.querySelector('.button-spinner');
|
| 186 |
|
| 187 |
// Toggle upload mode
|
| 188 |
folderLabel.addEventListener('click', () => {
|
|
|
|
| 198 |
fileUpload.classList.remove('hidden');
|
| 199 |
folderUpload.classList.add('hidden');
|
| 200 |
});
|
| 201 |
+
|
| 202 |
+
// Handle form submission
|
| 203 |
+
document.getElementById('db-form').addEventListener('submit', function(event) {
|
| 204 |
+
event.preventDefault(); // Prevent form submission for demonstration
|
| 205 |
+
submitButton.classList.add('btn-loading');
|
| 206 |
+
// Simulate loading
|
| 207 |
+
setTimeout(() => {
|
| 208 |
+
// After form is "submitted" and loading is complete
|
| 209 |
+
submitButton.classList.remove('btn-loading');
|
| 210 |
+
alert("Form submitted successfully!"); // Simulate success
|
| 211 |
+
}, 2000); // 2 seconds for loading simulation
|
| 212 |
+
});
|
| 213 |
</script>
|
| 214 |
|
| 215 |
{% endblock %}
|