From fd59d34aa2440e6258a90845eba9a1b9b4d3893d Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 17 Nov 2016 14:28:35 +0800 Subject: webui: Implement "showModal()" in "main.js" allowing use in others --- fg21sim/webui/static/js/configs.js | 45 ++----------------------------- fg21sim/webui/static/js/main.js | 55 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 43 deletions(-) (limited to 'fg21sim/webui/static/js') diff --git a/fg21sim/webui/static/js/configs.js b/fg21sim/webui/static/js/configs.js index 4b01ca3..2910ede 100644 --- a/fg21sim/webui/static/js/configs.js +++ b/fg21sim/webui/static/js/configs.js @@ -297,50 +297,11 @@ var updateFormConfigStatus = function () { /** - * Compose the notification contents and shown in the "#modal-configs" - * modal box. - * - * The input `data` may have the following attributes: - * - `icon` : FontAwesome icon (specified without the beginning `fa-`) - * - `message` : Main summary message - * - `code` : Error code if it is an error notification - * - `reason` : Reason of the error - * - `buttons` : A list of buttons + * Show notification contents in the "#modal-configs" modal box. */ var showConfigsModal = function (data) { var modalBox = $("#modal-configs"); - modalBox.html(""); - var p = $("

"); - if (data.icon) { - $("").addClass("fa fa-2x").addClass("fa-" + data.icon).appendTo(p); - } - if (data.message) { - $("").text(" " + data.message).appendTo(p); - } - modalBox.append(p); - if (data.code) { - modalBox.append($("

Error Code:

") - .append($("") - .addClass("label label-warning") - .text(data.code))); - } - if (data.reason) { - modalBox.append($("

Reason:

") - .append($("") - .addClass("label label-warning") - .text(data.reason))); - } - if (data.buttons) { - p = $("

").addClass("button-group"); - data.buttons.forEach(function (btn) { - $("