From 4114bdc7bb7c02488deff9f06057eef7fd7deeb8 Mon Sep 17 00:00:00 2001 From: alext Date: Tue, 14 Nov 2017 13:55:35 +0100 Subject: [PATCH] Dialog buttons should be defined with an array. --- src/assets/js/general_functions.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/assets/js/general_functions.js b/src/assets/js/general_functions.js index d57d1356..73f9abcb 100644 --- a/src/assets/js/general_functions.js +++ b/src/assets/js/general_functions.js @@ -36,9 +36,9 @@ window.GeneralFunctions = window.GeneralFunctions || {}; * * @param {String} title The title of the message box. * @param {String} message The message of the dialog. - * @param {Array} messageButtons Contains the dialog buttons along with their functions. + * @param {Array} buttons Contains the dialog buttons along with their functions. */ - exports.displayMessageBox = function(title, message, messageButtons) { + exports.displayMessageBox = function(title, message, buttons) { // Check arguments integrity. if (title == undefined || title == '') { title = ''; @@ -48,11 +48,16 @@ window.GeneralFunctions = window.GeneralFunctions || {}; message = ''; } - if (messageButtons == undefined) { - messageButtons = {}; - messageButtons[EALang.close] = function() { - $('#message_box').dialog('close'); - }; + if (buttons == undefined) { + buttons = [ + { + text: EALang.close, + click: function () { + $('#message_box').dialog('close'); + + } + } + ]; } // Destroy previous dialog instances. @@ -73,7 +78,7 @@ window.GeneralFunctions = window.GeneralFunctions || {}; width: 'auto', height: 'auto', resizable: false, - buttons: messageButtons, + buttons: buttons, closeOnEscape: true });