created toast.js with a StatusMsg() func that dynamically adds toasts that can stack as we need more, and changed over code to use it

This commit is contained in:
2023-01-04 23:36:20 +11:00
parent 3384c5337a
commit a64b449327
2 changed files with 6 additions and 7 deletions

View File

@@ -17,6 +17,7 @@
<script src="{{ url_for( 'internal', filename='upstream/bootstrap-5.0.2-dist/js/bootstrap.bundle.min.js')}}"></script>
<script src="{{ url_for( 'internal', filename='upstream/jquery.contextMenu.min.js')}}"></script>
<script src="{{ url_for( 'internal', filename='upstream/jquery.ui.position.min.js')}}"></script>
<script src="{{ url_for( 'internal', filename='js/toast.js')}}"></script>
<link rel="shortcut icon" href="{{ url_for('internal', filename='favicon.ico') }}">
@@ -162,14 +163,13 @@
{% if not InDBox %}
{%block script_content %}{% endblock script_content %}
<div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
<div id="status_toast" class="toast align-items-center text-white bg-success border-0" role="alert" aria-live="assertive" aria-atomic="true">
<div id="status_container" class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
<div id="st1" class="toast hide align-items-center text-white bg-success border-0" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body">
Hello, world! This is a toast message.
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
</div>
{% if GetMessage()|length %}
@@ -177,8 +177,7 @@
$(document).ready(function() {
msg = "{{ GetMessage()|safe }}"
msg=msg.replace('href=', 'class=link-light href=')
$('.toast-body').html( msg )
$('.toast').toast("show");
st=Object; st.message=msg; st.alert="success"; StatusMsg(st)
} )
</script>
{{ ClearStatus() }}