Skip to content

Commit

Permalink
PNotify
Browse files Browse the repository at this point in the history
  • Loading branch information
loveorigami committed Mar 30, 2016
1 parent d9172b6 commit 11f0a11
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

* 2.3 [30 March 2016]
- `enh` Added new layer - PNotify
- `enh` Added new layer - Jquery Notify
- `fix` Fixed translations

* 2.2 [29 March 2016]
- `enh` Added new layer - Noty.js

Expand All @@ -9,7 +14,6 @@
* 2.0 [26 March 2016]
- `enh` Added new entity "Layers".
- `enh` Delete widgets from composer.
- `fix` Fixed translations sourceLanguage (thezilla-)

* 1.1 [22 March 2016]
- `enh` Rename Noty to Wrapper. First stable release
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Currently supported layers are:
| Jquery Notify | jquery.notify | https://github.com/CreativeDream/jquery.notify | [read](docs/JqueryNotify.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) |
| Toastr | toastr | https://github.com/CodeSeven/toastr | [read](docs/Toastr.md) |


Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "yii2-extension",
"keywords": [
"yii2", "module", "notification", "flash",
"noty", "toastr", "growl", "alert", "notyjs"
"noty", "toastr", "growl", "alert", "notyjs", "notyfy", "pnotyfy"
],
"homepage": "https://github.com/loveorigami/yii2-notification-wrapper",
"time": "2016-03-29",
Expand Down
1 change: 1 addition & 0 deletions docs/JqueryNotify.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# JqueryNotify
!["Jquery Notify"](img/jnotify.jpg)

Installation
--------
Expand Down
42 changes: 42 additions & 0 deletions docs/PNotify.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# PNotify
!["Jquery Notify"](img/pnotify.jpg)

Installation
--------

```bash
"loveorigami/yii2-notification-wrapper": "*",
"bower-asset/pnotify": "^3.0"
```

to the ```require``` section of your `composer.json` file.


Usage
-----

```php
use lo\modules\noty\widgets\Wrapper;

echo Wrapper::widget([
'layerClass' => 'lo\modules\noty\widgets\layers\PNotify',
'options' => [
'styling' => 'brighttheme', // jqueryui, bootstrap3, brighttheme
'min_height' => '16px',
'delay' => 3000,
'icon' => true,
'remove' => false,
'shadow' => true,
'mouse_reset' => true,
'buttons' =>[
'closer' => true,
'sticker' => true
]

// and more for this library here https://github.com/sciactive/pnotify

],
]);


```
Binary file added docs/img/pnotify.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions src/widgets/layers/PNotify.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

namespace lo\modules\noty\widgets\layers;

use yii\helpers\Json;
use lo\modules\noty\widgets\Wrapper;

/**
* Class PNotify
* @package lo\modules\noty\widgets\layers
*
* This widget should be used in your main layout file as follows:
* ---------------------------------------
* use lo\modules\noty\widgets\Wrapper;
*
* echo Wrapper::widget([
* 'layerClass' => 'lo\modules\noty\widgets\layers\PNotify',
* 'options' => [
* 'styling' => 'brighttheme', // jqueryui, bootstrap3, brighttheme
* 'delay' => 3000,
* 'icon' => true,
* 'remove' => false,
* 'shadow' => true,
* 'mouse_reset' => true,
* 'buttons' =>[
* 'closer' => true,
* 'sticker' => true
* ]
*
* // and more for this library...
* ],
* ]);
* ---------------------------------------
*/
class PNotify extends Wrapper implements LayerInterface
{
/**
* @inheritdoc
*/
public function run()
{
PNotifyAsset::register($this->getView());
}


/**
* @inheritdoc
*/
public function getNotification($type, $message, $options)
{
$options['title'] = $this->getTitle($type);
$options['type'] = $type;
$options['text'] = $message;
$options = Json::encode($options);

return "new PNotify($options);";
}

}
40 changes: 40 additions & 0 deletions src/widgets/layers/PNotifyAsset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace lo\modules\noty\widgets\layers;

use yii\web\AssetBundle;

/**
* Class PNotifyAsset
* @package lo\modules\noty\widgets\layers
*/
class PNotifyAsset extends AssetBundle
{
/** @var string */
public $sourcePath = '@bower/pnotify/dist';

/** @var array $css */
public $css = [
'pnotify.css',
'pnotify.brighttheme.css',
'pnotify.buttons.css',
'pnotify.history.css',
'pnotify.mobile.css',
];

/** @var array $js */
public $js = [
'pnotify.js',
'pnotify.animate.js',
'pnotify.buttons.js',
'pnotify.desktop.js',
'pnotify.history.js',
'pnotify.mobile.js',
'pnotify.nonblock.js',
];

/** @var array $depends */
public $depends = [
'yii\web\JqueryAsset'
];
}

0 comments on commit 11f0a11

Please sign in to comment.