Skip to content

Commit

Permalink
#2 c5 notification widget implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
1stthomas committed May 28, 2021
1 parent 8534a11 commit 8067884
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
31 changes: 31 additions & 0 deletions js/ht7.widgets.c5.js
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
};

0 comments on commit 8067884

Please sign in to comment.