From 80cf094c02b4763f1f84e9f7717cb6822b6d85f9 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Fri, 31 Mar 2023 20:16:26 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03795=20-=20Improve=20JSDoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/pages/backoffice/toolbox.js | 11 ++++------- js/utils.js | 34 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/js/pages/backoffice/toolbox.js b/js/pages/backoffice/toolbox.js index 90a27ed1b..ef3e148f1 100644 --- a/js/pages/backoffice/toolbox.js +++ b/js/pages/backoffice/toolbox.js @@ -353,11 +353,11 @@ CombodoModal._CenterModalInViewport = function (oModalElem) { }; /** - * Open a standard confirmation modal and put the content into it. + * @override + * @inheritDoc * * @param oOptions array @see CombodoModal.OpenModal + {do_not_show_again_pref_key: string, callback_on_confirm: function, callback_on_cancel} * @param aData data passed to callbacks - * @returns object The jQuery object of the modal element */ CombodoModal.OpenConfirmationModal = function(oOptions, aData) { @@ -433,11 +433,8 @@ CombodoModal.OpenConfirmationModal = function(oOptions, aData) { } /** - * Open a standard informative modal. - * - * @param sMessage string Informative message to be displayed in the modal - * @param sSeverity string Severity of the information. Default values are success, information, warning, error. - * @param oOptions array @see CombodoModal.OpenModal + * @override + * @inheritDoc */ CombodoModal.OpenInformativeModal = function(sMessage, sSeverity, oOptions) { let sFirstLetterUppercaseSeverity = sSeverity.charAt(0).toUpperCase() + sSeverity.slice(1); diff --git a/js/utils.js b/js/utils.js index ccdd4898e..3ce7a2648 100644 --- a/js/utils.js +++ b/js/utils.js @@ -1211,9 +1211,13 @@ const CombodoInlineImage = { */ let CombodoModal = { + /** @var {String} */ INFORMATIVE_MODAL_SEVERITY_SUCCESS : 'success', + /** @var {String} */ INFORMATIVE_MODAL_SEVERITY_INFORMATION : 'information', + /** @var {String} */ INFORMATIVE_MODAL_SEVERITY_WARNING : 'warning', + /** @var {String} */ INFORMATIVE_MODAL_SEVERITY_ERROR : 'error', /** @@ -1415,14 +1419,13 @@ let CombodoModal = { // Meant for overlaoding CombodoJSConsole.Debug('CombodoModal.OpenConfirmationModal not implemented'); }, - - /** - * Open a standard informative modal. + * Open a standard informative modal, should only be extended to created your own modal method to prepare a custom informative modal + * In most cases you should prefer {@see CombodoModal.OpenSuccessModal}, {@see CombodoModal.OpenInformativeModal}, {@see CombodoModal.OpenWarningModal}, {@see CombodoModal.OpenErrorModal} * - * @param sMessage string Informative message to be displayed in the modal - * @param sSeverity string Severity of the information. Default values are success, information, warning, error. - * @param oOptions array @see CombodoModal.OpenModal + * @param sMessage {String} Informative message to be displayed in the modal + * @param sSeverity {String} Severity of the information. Default values are success, information, warning, error. + * @param oOptions {Object | null} {@see CombodoModal.OpenModal} */ OpenInformativeModal: function(sMessage,sSeverity, oOptions) { // Meant for overlaoding @@ -1432,38 +1435,35 @@ let CombodoModal = { /** * Open a standard informative modal for success messages. * - * @param sMessage string Informative success message to be displayed in the modal - * @param oOptions array @see CombodoModal.OpenModal + * @param sMessage {String} Informative success message to be displayed in the modal + * @param oOptions {Object | null} {@see CombodoModal.OpenModal} */ OpenSuccessModal: function(sMessage, oOptions) { CombodoModal.OpenInformativeModal(sMessage, CombodoModal.INFORMATIVE_MODAL_SEVERITY_SUCCESS, oOptions); }, - /** * Open a standard informative modal for information messages. * - * @param sMessage string Informative information success to be displayed in the modal - * @param oOptions array @see CombodoModal.OpenModal + * @param sMessage {String} Informative information success to be displayed in the modal + * @param oOptions {Object | null} {@see CombodoModal.OpenModal} */ OpenInformationModal: function(sMessage, oOptions) { CombodoModal.OpenInformativeModal(sMessage, CombodoModal.INFORMATIVE_MODAL_SEVERITY_INFORMATION, oOptions); }, - /** * Open a standard informative modal for warning messages. * - * @param sMessage string Informative warning message to be displayed in the modal - * @param oOptions array @see CombodoModal.OpenModal + * @param sMessage {String} Informative warning message to be displayed in the modal + * @param oOptions {Object | null} {@see CombodoModal.OpenModal} */ OpenWarningModal: function(sMessage, oOptions) { CombodoModal.OpenInformativeModal(sMessage, CombodoModal.INFORMATIVE_MODAL_SEVERITY_WARNING, oOptions); }, - /** * Open a standard informative error modal for success messages. * - * @param sMessage string Informative error message to be displayed in the modal - * @param oOptions array @see CombodoModal.OpenModal + * @param sMessage {String} Informative error message to be displayed in the modal + * @param oOptions {Object | null} {@see CombodoModal.OpenModal} */ OpenErrorModal: function(sMessage, oOptions) { CombodoModal.OpenInformativeModal(sMessage, CombodoModal.INFORMATIVE_MODAL_SEVERITY_ERROR, oOptions);