From 5629f2c7c566a106111d970b7caad92f4ad3f829 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Mon, 21 Dec 2020 18:25:36 +0100 Subject: [PATCH] Development: add documentation for Javascript helpers (https://github.com/opnsense/docs/issues/241) dialog wrappers --- .../development/frontend/view_js_helpers.rst | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/source/development/frontend/view_js_helpers.rst b/source/development/frontend/view_js_helpers.rst index be11be3..135d212 100644 --- a/source/development/frontend/view_js_helpers.rst +++ b/source/development/frontend/view_js_helpers.rst @@ -151,6 +151,46 @@ It assumes the following endpoints exists for the module: * stop the service +---------------------------- +Dialog wrappers +---------------------------- + +We are using `BootstrapDialog `__ to display standard dialogs, to limit +the boilerplates needed to show these dialog we added the following wrapper funcitons: + + +stdDialogInform(title, message, close, callback, type, cssClass) +.............................................................................................. + +Informational dialog with a single close button, using the following parameters: + +* title: :code:`string` dialog title +* message: :code:`string` dialog message +* close: :code:`string` close button text +* callback: :code:`function()` to be called after close +* type: :code:`string` dialog type. one of : danger, default, info, primary, success, warning +* cssClass: :code:`string` css class to use + + +stdDialogConfirm(title, message, accept, decline, callback, type) +.............................................................................................. + +Ok/Cancel dialog type using the following parameters: + +* title: :code:`string` dialog title +* message: :code:`string` dialog message +* accept: :code:`string` accept button text +* decline: :code:`string` decline button text +* callback: :code:`function()` to be called after close +* type: :code:`string` dialog type. one of : danger, default, info, primary, success, warning + + + +stdDialogRemoveItem(message, callback) +.............................................................................................. + +Simple remove item (warning) dialog, using a message and optionally a callback. + ---------------------------- $.SimpleActionButton ----------------------------