Fix WebSocket block and add sync spinner to discord_channels UI
This commit is contained in:
@@ -102,9 +102,9 @@
|
||||
<a href="/diagnosis" class="btn btn-outline-secondary me-2">
|
||||
<i class="bi bi-bug"></i> {{ "Diagnóstico" | translate(lang) }}
|
||||
</a>
|
||||
<form method="post" action="/discord-channels/sync" class="d-inline">
|
||||
<button type="submit" class="btn btn-primary" onclick="return confirm('{{ '¿Sincronizar servidores y canales desde Discord?' | translate(lang) }}')">
|
||||
<i class="bi bi-arrow-repeat"></i> {{ "Sincronizar" | translate(lang) }}
|
||||
<form method="post" action="/discord-channels/sync" class="d-inline" id="syncForm">
|
||||
<button type="button" class="btn btn-primary" id="syncBtn" onclick="handleSync()">
|
||||
<i class="bi bi-arrow-repeat" id="syncIcon"></i> <span id="syncText">{{ "Sincronizar" | translate(lang) }}</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -265,6 +265,20 @@
|
||||
checkbox.addEventListener('change', updateBulkButtons);
|
||||
});
|
||||
});
|
||||
|
||||
function handleSync() {
|
||||
if (confirm('{{ "¿Sincronizar servidores y canales desde Discord?" | translate(lang) }}')) {
|
||||
const btn = document.getElementById('syncBtn');
|
||||
const icon = document.getElementById('syncIcon');
|
||||
const text = document.getElementById('syncText');
|
||||
|
||||
btn.disabled = true;
|
||||
icon.className = 'spinner-border spinner-border-sm';
|
||||
text.innerText = ' {{ "Sincronizando..." | translate(lang) }}';
|
||||
|
||||
document.getElementById('syncForm').submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user