Fix up voting and start adding club logos
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
|
||||
<div class="mb-3">
|
||||
{{ form.logo_url.label(class="form-label") }}
|
||||
{{ form.logo_url(class="form-control") }}
|
||||
{{ form.logo_url(class="form-control", id="logoUrl", onchange="previewLogo()") }}
|
||||
{% if form.logo_url.errors %}
|
||||
<div class="text-danger">
|
||||
{% for error in form.logo_url.errors %}
|
||||
@@ -52,6 +52,15 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
<small class="form-text text-muted">Enter the full URL to the club's logo image</small>
|
||||
|
||||
<!-- Logo Preview -->
|
||||
<div id="logoPreview" class="mt-2" style="display: none;">
|
||||
<label class="form-label small">Preview:</label>
|
||||
<div class="border rounded p-2 bg-light">
|
||||
<img id="previewImage" src="" alt="Logo preview" style="max-height: 80px; max-width: 120px;" onerror="this.style.display='none'; document.getElementById('previewError').style.display='block';" onload="document.getElementById('previewError').style.display='none';">
|
||||
<div id="previewError" class="text-muted small" style="display: none;">Unable to load image</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
|
||||
@@ -70,5 +79,25 @@
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<script>
|
||||
function previewLogo() {
|
||||
const urlInput = document.getElementById('logoUrl');
|
||||
const previewDiv = document.getElementById('logoPreview');
|
||||
const previewImg = document.getElementById('previewImage');
|
||||
|
||||
if (urlInput.value.trim()) {
|
||||
previewImg.src = urlInput.value;
|
||||
previewDiv.style.display = 'block';
|
||||
} else {
|
||||
previewDiv.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
// Preview logo on page load if URL is already filled
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
previewLogo();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user