diff --git a/controller.php b/controller.php index 6c58623..35bffc8 100644 --- a/controller.php +++ b/controller.php @@ -127,6 +127,13 @@ private function registerAssets() ['version' => '0.0.1', 'minify' => true, 'combine' => true], $this ); + $al->register( + 'javascript', + 'ht7-widgets/concrete5', + 'js/ht7.widgets.c5.js', + ['version' => '0.0.1', 'minify' => true, 'combine' => true], + $this + ); $al->registerGroup( 'ht7-widgets/body-overlay', diff --git a/js/ht7.widgets.c5.js b/js/ht7.widgets.c5.js new file mode 100644 index 0000000..90aa54f --- /dev/null +++ b/js/ht7.widgets.c5.js @@ -0,0 +1,31 @@ +var ht7 = ht7 || {}; +ht7.widgets = ht7.widgets || {}; + +ht7.widgets.c5 = { + notification: { + /** + * Show a concrete5 notification. + * + * @param {string} title The title of the c5 notification. + * @param {string} msg The content of the c5 + * notification. + * @param {string} alertType The kind of the c5 notification. + * Supported types: 'success', + * 'error', null. + */ + add: function(title, msg, alertType) { + const parameters = { + title: title, + message: msg + }; + + if (alertType === 'success') { + ConcreteAlert.notify(parameters); + } else if (alertType === 'error') { + ConcreteAlert.error(parameters); + } else { + ConcreteAlert.info(parameters); + } + } + } +};