From 5dd5e04479ae8b11685a0b39e420c796683988a8 Mon Sep 17 00:00:00 2001 From: Andreas <andreasv@fsmpi.rwth-aachen.de> Date: Thu, 20 Apr 2017 13:14:46 +0200 Subject: [PATCH] closes #237 --- static/moderator.js | 11 +++++++++-- templates/base.html | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/static/moderator.js b/static/moderator.js index ca809f1..ebef4a2 100644 --- a/static/moderator.js +++ b/static/moderator.js @@ -2,7 +2,10 @@ var moderator = { api: { csrf_token: '', init: function () { - + $("#modal_apierror").on('hidden.bs.modal', function () { + $(".modal-body", $("#modal_apierror"))[0].innerHTML = ''; + $(".modal-body", $("#modal_apierror"))[0].innerHTML = ''; + }); }, set: function(path,value,reload) { var req = {}; @@ -43,6 +46,8 @@ var moderator = { }, handleapierror: function(jqXHR, textStatus, errorThrow) { console.log("Fehler: "+errorThrow) + $(".modal-body", $("#modal_apierror"))[0].innerHTML += "<p>" + errorThrow + ": " + textStatus + "</p>"; + $("#modal_apierror").modal() }, gethttp: function (url){ $.ajax({ @@ -247,7 +252,9 @@ var moderator = { } }; -$( document ).ready( function () { moderator.init(); } ); +$( document ).ready( function () { + moderator.init(); +} ); $( document ).ready( function () { var l = $(".plot-view"); diff --git a/templates/base.html b/templates/base.html index 6b5e709..edeac6a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -154,6 +154,22 @@ </div> </footer> {% endblock %} + {% block modals %} + <div class="modal fade" id="modal_apierror" role="dialog"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 style="color:red;"><span class="glyphicon glyphicon-exclamation-sign"></span> Error</h4> + </div> + <div class="modal-body"> + </div> + <div class="modal-footer"> + </div> + </div> + </div> + </div> + {% endblock %} </body> {% if ismod() %} <script> -- GitLab