diff --git a/README.md b/README.md index 544dfb4..5af7056 100644 --- a/README.md +++ b/README.md @@ -196,22 +196,23 @@ For example: Currently supported layers are: -| Library (Layer) | Bower | Confirm | Project homepage | Docs | -| ------------------ | ------------- | ------- | ------------------------------------------------ | -------------------------------- | -| Bootstrap Alert | - | - | http://getbootstrap.com/components/#alerts | [read](docs/Alert.md) | -| Growl | jquery-growl | - | https://github.com/ksylvest/jquery-growl | [read](docs/Growl.md) | -| iGrowl | igrowl | - | https://github.com/catc/iGrowl | [read](docs/Igrowl.md) | -| Jquery Notify | jquery.notify | - | https://github.com/CreativeDream/jquery.notify | [read](docs/JqueryNotify.md) | -| jQuery Notify Bar | jqnotifybar | - | https://github.com/dknight/jQuery-Notify-bar | [read](docs/JqueryNotifyBar.md) | -| Lobibox | lobibox | + | https://github.com/arboshiki/lobibox | [read](docs/Lobibox.md) | -| Notie | notie | + | https://github.com/jaredreich/notie | [read](docs/Notie.md) | -| Notific8 | notific8 | - | https://github.com/ralivue/notific8 | [read](docs/Notific8.md) | -| NotifIt | notifit | + | https://github.com/naoxink/notifIt | [read](docs/NotifIt.md) | -| Notify.js | notifyjs | - | https://github.com/notifyjs/notifyjs | [read](docs/Notifyjs.md) | -| Noty | noty | + | https://github.com/needim/noty | [read](docs/Noty.md) | -| PNotify | pnotify | + | https://github.com/sciactive/pnotify | [read](docs/PNotify.md) | -| Sweetalert | sweetalert | + | https://github.com/t4t5/sweetalert | [read](docs/Sweetalert.md) | -| Toastr | toastr | - | https://github.com/CodeSeven/toastr | [read](docs/Toastr.md) | +| Library (Layer) | Bower | Confirm | Project homepage | Docs | +| ------------------ | --------------------------- | ------- | ------------------------------------------------ | -------------------------------- | +| Bootstrap Alert | - | - | http://getbootstrap.com/components/#alerts | [read](docs/Alert.md) | +| Bootstrap Notify | remarkable-bootstrap-notify | - | https://github.com/mouse0270/bootstrap-notify | [read](docs/BootstrapNotify.md) | +| Growl | jquery-growl | - | https://github.com/ksylvest/jquery-growl | [read](docs/Growl.md) | +| iGrowl | igrowl | - | https://github.com/catc/iGrowl | [read](docs/Igrowl.md) | +| Jquery Notify | jquery.notify | - | https://github.com/CreativeDream/jquery.notify | [read](docs/JqueryNotify.md) | +| jQuery Notify Bar | jqnotifybar | - | https://github.com/dknight/jQuery-Notify-bar | [read](docs/JqueryNotifyBar.md) | +| Lobibox | lobibox | + | https://github.com/arboshiki/lobibox | [read](docs/Lobibox.md) | +| Notie | notie | + | https://github.com/jaredreich/notie | [read](docs/Notie.md) | +| Notific8 | notific8 | - | https://github.com/ralivue/notific8 | [read](docs/Notific8.md) | +| NotifIt | notifit | + | https://github.com/naoxink/notifIt | [read](docs/NotifIt.md) | +| Notify.js | notifyjs | - | https://github.com/notifyjs/notifyjs | [read](docs/Notifyjs.md) | +| Noty | noty | + | https://github.com/needim/noty | [read](docs/Noty.md) | +| PNotify | pnotify | + | https://github.com/sciactive/pnotify | [read](docs/PNotify.md) | +| Sweetalert | sweetalert | + | https://github.com/t4t5/sweetalert | [read](docs/Sweetalert.md) | +| Toastr | toastr | - | https://github.com/CodeSeven/toastr | [read](docs/Toastr.md) | ## Full installation @@ -232,6 +233,7 @@ Add "bower-asset/notifyjs": "^0.4", "bower-asset/pnotify": "^3.0", "bower-asset/noty": "^2.3", +"bower-asset/remarkable-bootstrap-notify": "^3.1", "bower-asset/sweetalert": "^1.1", "bower-asset/toastr": "^2.1" ``` diff --git a/docs/BootstrapNotify.md b/docs/BootstrapNotify.md new file mode 100644 index 0000000..2b2b066 --- /dev/null +++ b/docs/BootstrapNotify.md @@ -0,0 +1,36 @@ +# Bootstrap Notify +!["Bootstrap Notify"](img/bootstrap-notify.jpg) + +Installation +-------- + +```bash +"loveorigami/yii2-notification-wrapper": "*", +"bower-asset/remarkable-bootstrap-notify": "^3.1", +``` + +to the ```require``` section of your `composer.json` file. + + +Usage +----- + +```php +use lo\modules\noty\Wrapper; + +echo Wrapper::widget([ + 'layerClass' => 'lo\modules\noty\layers\BootstrapNotify', + // default options + 'options' => [ + 'newest_on_top' => false, + 'showProgressbar' => true, + 'placement' => [ + 'from' => 'top', + 'align' => 'right' + ] + + // and more for this library here https://github.com/mouse0270/bootstrap-notify + ], +]); + +``` diff --git a/docs/img/bootstrap-notify.jpg b/docs/img/bootstrap-notify.jpg new file mode 100644 index 0000000..d3536f9 Binary files /dev/null and b/docs/img/bootstrap-notify.jpg differ diff --git a/src/assets/BootstrapNotifyAsset.php b/src/assets/BootstrapNotifyAsset.php new file mode 100644 index 0000000..5f38bf5 --- /dev/null +++ b/src/assets/BootstrapNotifyAsset.php @@ -0,0 +1,25 @@ + 'lo\modules\noty\layers\BootstrapNotify', + * 'options' => [ + * 'fixed' => true, + * 'size' => 'medium', + * 'location' => 'tr', + * 'delayOnHover' => true, + * + * // and more for this library... + * ], + * ]); + * --------------------------------------- + */ +class BootstrapNotify extends Layer implements LayerInterface +{ + + /** + * @var array $defaultOptions + */ + protected $defaultOptions = [ + 'newest_on_top' => false, + 'showProgressbar' => false, + 'placement' => [ + 'from' => 'top', + 'align' => 'right' + ] + ]; + + /** + * register asset + */ + public function run() + { + $view = $this->getView(); + BootstrapNotifyAsset::register($view); + parent::run(); + } + + /** + * @param $options + * @return string + */ + public function getNotification($options) + { + $options['type'] = $this->getType(); + $options = Json::encode($options); + + $data['message'] = $this->getMessageWithTitle(); + //$data['title'] = $this->title; + $data = Json::encode($data); + + return "$.notify($data, $options);"; + } + + /** + * @return string + */ + public function getType() + { + switch ($this->type) { + case self::TYPE_ERROR: + $type = 'danger'; + break; + default: + $type = $this->type; + } + return $type; + } + +}