Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Allow multiple toast messages to show on page

givanz57bea880161b
diff --git a/public/js/admin.js b/public/js/admin.js
index 3b3dac1..bd773de 100755
--- a/public/js/admin.js
+++ b/public/js/admin.js
@@ -16,6 +16,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
+ * https://github.com/givanz/Vvveb
*/
@@ -80,9 +81,14 @@ function displayToast(bg, title, message, position = 'bottom', id = "bottom-toas
header.classList.remove("bg-danger", "bg-success");
header.classList.add(bg);
header.querySelector("strong").textContent = title;
+ let toastDisplay = toast.cloneNode(true);
+ toast.parentNode.appendChild(toastDisplay);
- let bsToast = new bootstrap.Toast(toast, {animation:false});
- bsToast.show()
+ let bsToast = new bootstrap.Toast(toastDisplay, {animation:true});
+ toastDisplay.addEventListener('hidden.bs.toast', () => {
+ toastDisplay.remove();
+ });
+ bsToast.show();
}
window.displayToast = displayToast;