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

@@ -64,7 +64,7 @@ function MoveSubmit()
// reorder the images via ecnt again, so highlighting can work // reorder the images via ecnt again, so highlighting can work
document.mf_id=0; $('.figure').each( function() { $(this).attr('ecnt', document.mf_id ); document.mf_id++ } ) document.mf_id=0; $('.figure').each( function() { $(this).attr('ecnt', document.mf_id ); document.mf_id++ } )
$('#dbox').modal('hide') $('#dbox').modal('hide')
$.ajax({ type: 'POST', data: $('#mv_fm').serialize(), url: '/move_files', success: function(data){ $('.toast-body').html( "Created&nbsp;<a class='link-light' href=/job/" + data.job_id + ">Job #" + data.job_id + "</a>&nbsp;to move selected file(s)" ); $('.toast').toast("show"); return false; } }) $.ajax({ type: 'POST', data: $('#mv_fm').serialize(), url: '/move_files', success: function(data){ st=Object; st.message="Created&nbsp;<a class='link-light' href=/job/" + data.job_id + ">Job #" + data.job_id + "</a>&nbsp;to move selected file(s)"; st.alert="success"; StatusMsg(st); return false; } })
} }
// show the DBox for a move file, includes all thumbnails of selected files to move // show the DBox for a move file, includes all thumbnails of selected files to move

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