Toast de confirmacion de pregunta creada #10

Merged
jorge merged 1 commits from toast into main 2026-09-29 13:04:21 +02:00
2 changed files with 22 additions and 3 deletions
Showing only changes of commit f5a354025e - Show all commits
+11 -1
View File
@@ -231,6 +231,8 @@ $("#formCrearPregunta").on("submit", function (e) {
// Volvemos a activar el botón // Volvemos a activar el botón
boton.prop("disabled", false); boton.prop("disabled", false);
boton.text("Crear pregunta"); boton.text("Crear pregunta");
// Toast exito
mostrarToast()
} }
}, },
@@ -243,4 +245,12 @@ $("#formCrearPregunta").on("submit", function (e) {
boton.text("Crear pregunta"); boton.text("Crear pregunta");
}, },
}); });
}); });
function mostrarToast() {
const toastMensaje = document.getElementById("ToastCrearPregunta");
if (toastMensaje) {
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastMensaje);
toastBootstrap.show();
}
}
+11 -2
View File
@@ -174,8 +174,17 @@ $avatarUsuario = htmlspecialchars($_SESSION['avatar'] ?? 'img/avatars/defaultPro
</div> </div>
</div> </div>
<!-- TOAST PREGUNTA CREADA -->
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="ToastCrearPregunta" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class=" toast-header" style="background-color: #46178f;">
<h5 class="text-white me-auto bi bi-joystick me-2"> Pregunta Creada</h5>
</div>
<div class="fs-6 toast-body">
La pregunta ha sido creada correctamente
</div>
</div>
</div>
<!-- MODAL CREAR PREGUNTA --> <!-- MODAL CREAR PREGUNTA -->
<div class="modal fade" <div class="modal fade"
id="modalCrearPregunta" id="modalCrearPregunta"