I just quickly wrote a widget for the JQuery plugin Pines Notify - Notifications for Bootstrap or jQuery UI.
Check the Pines Notify Website for examples and dokumentation.
Also have a look at this extension: Pines Tags
##Requirements
Yii 1.1 or above
##Usage Just extract the files in your extensions directory.
There are three ways to use this widget: the very simple way, the normal way, and the flash messages way.
This will create a very simple notification without a title and any options. Just submit a "message". Any given options will be ignored.
$this->widget('application.extensions.PNotify.PNotify',array(
'message'=>'I am really a very simple notification')
);
Result:
$.pnotify("I am really a very simple notification");
Here we go: DONT use the key "message", fill the notification with options.
$this->widget('application.extensions.PNotify.PNotify',array(
'options'=>array(
'title'=>'You did it!',
'text'=>'This notification is awesome! Awesome like you!',
'type'=>'success',
'closer'=>false,
'hide'=>false))
);
Result:
$.pnotify({'title':'You did it!','text':'This notification is awesome! Awesome like you!','type':'success','closer':false,'hide':false});
$this->widget('application.extensions.PNotify.PNotify',
array(
'flash_messages_only' => true,
)
);
And then when you do:
Yii::app()->user->setFlash('success', array('title' => 'Login Successful!', 'text' => 'You successfully logged in. Enjoy!'));
You get the nice message because of:
$.pnotify({'type':'success','title':'Login Successful!','text':'You successfully logged in. Enjoy!'});
You can use ALL the options Pines Notify offers.
$_default_options=array(
'title'=>false,
'title_escape'=>false,
'text'=>false,
'text_escape'=>false,
'styling'=>"bootstrap",
'addclass'=>"",
'cornerclass'=>"",
'nonblock'=>false,
'nonblock_opacity'=>.2,
'history'=>true,
'auto_display'=>true,
'width'=>"300px",
'min_height'=>"16px",
'type'=>"notice",
'icon'=>true,
'animation'=>"fade",
'animate_speed'=>"slow",
'opacity'=>1,
'shadow'=>true,
'closer'=>true,
'closer_hover'=>true,
'sticker'=>true,
'sticker_hover'=>true,
'hide'=>true,
'delay'=>8000,
'mouse_reset'=>true,
'remove'=>true,
'insert_brs'=>true,
'stack'=>array(
'dir1'=>'down',
'dir2'=>'left',
'push'=>'bottom',
'spacing1'=>25,
'spacing2'=>25,
),
);
##Resources
- Pines Notify
- Try out a bunch of demos
- Yii extension: fancybox (I have stolen the widget skeleton code :D )