From fbb98827f0cd6926ecd0f12ba33dc88d1f03f85e Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Mon, 4 Jun 2018 21:28:43 +0200 Subject: [PATCH] Convert error dialog to new Popup class --- src/infodrom.css | 36 +++++++++++++++++++----------------- src/infodrom.js | 33 +++++++++++++++------------------ 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/infodrom.css b/src/infodrom.css index 0404a1e..ad15cbe 100644 --- a/src/infodrom.css +++ b/src/infodrom.css @@ -159,15 +159,18 @@ div.popup { position: absolute; } div.popup_title { + top: 0px; width: 100%; background: #b0e2ff; margin-top: -1em; margin-bottom: 0px; font-weight: bold; - padding-bottom: 1em; + padding-top: 0px; + padding-bottom: 1.35ex; border-bottom: 1px solid #777; } div.popup_title p { + padding-left: 3px; padding-bottom: 0px; margin-bottom: -0.65em; cursor: move; @@ -187,6 +190,21 @@ div.popup label { margin-top: 2px; display: block; } +div.popup#errorwindow div.popup_title { + background: #ffa54f; + background: #ff3030; +} +div.popup#errorwindow div.popup_title p { + color: white; +} +div.popup#errorwindow div#errorbody { + padding: 5px; + font-weight: bold; + font-size: 110%; +} +div.popup#errorwindow div.popup_body { + background: #ffe4c4; +} /* * Calendar @@ -205,22 +223,6 @@ div#message_div { font-size: 120%; padding: 5px; } -div#error_div { - background: white; - color: black; - border: 2px solid red; -} -div#error_div div { - font-size: 120%; - font-weight: bold; - padding: 5px; -} -div#error_div p { - text-align: right; - padding: 2px; - margin: 0; - border-bottom: 1px solid #CCC; -} .autocomplete-suggestions { background: white; diff --git a/src/infodrom.js b/src/infodrom.js index e76b2ae..1190b40 100644 --- a/src/infodrom.js +++ b/src/infodrom.js @@ -22,30 +22,22 @@ function hide_message(text) $('#message_div').hide(); } +var errorwindow = false; function show_error(text, timeout) { - var div = $('#error_div'); - if (!div.length) { - div = $('
'); - div.attr('id', 'error_div').css('z-index','1000'); - div.hide(); - div.append($('

')); - div.append($('
')); - $(document.body).append(div); + if (!errorwindow) { + errorwindow = new Popup('Fehler', '500px', false, '
'); + errorwindow.setId('errorwindow'); + $('#errorwindow').css('z-index','1000'); + errorwindow.centerPopup(); + } else { + errorwindow.openPopup(); } - div.find('div').html(text); - div.center(); - div.show(); + $('#errorbody').html(text); if (typeof timeout != 'undefined') - window.setTimeout(hide_error,timeout*1000); -} - -function hide_error(text) -{ - $('#error_div').hide(); - return false; + window.setTimeout(function(){errorwindow.closePopup()},timeout*1000); } function editable_callback(data) @@ -179,6 +171,11 @@ Popup.prototype = { this.popup.hide(); }, + setId: function(name) + { + this.popup.attr('id', name); + }, + setTitle: function(title) { this.popup.find('div.popup_title p.popup_title').html(title); -- 2.20.1