Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sakulstra/cakephp-timedmessages
css3 animated and automatically view extending flashmessages
https://github.com/sakulstra/cakephp-timedmessages
Last synced: 26 days ago
JSON representation
css3 animated and automatically view extending flashmessages
- Host: GitHub
- URL: https://github.com/sakulstra/cakephp-timedmessages
- Owner: sakulstra
- Created: 2013-05-22T23:32:36.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-07-16T10:53:59.000Z (over 11 years ago)
- Last Synced: 2024-05-29T17:25:12.317Z (5 months ago)
- Language: PHP
- Size: 141 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
TimedMessages Plugin
====================
## Motivation
There are some problems with Session::flash() |<- my opinion1. you have to call ```$this->Session->flash('messageType');```, for every single messageType.
2. the flashmessages are shown afterRender(), so after i couple of minutes you can't be sure whether the message is new or old(no Page reload for a while)
3. if you don't have a ```$this->Session->flash('messageType')``` in every layout/view a flashmessage can be displayed when it's already out-dated### Tasks
- [x] automagical display of ALL flashMessages
- [x] hide flashmessages after Time
- [x] possibility to display them again## Installation
1. move the Plugin 'TimedMessages' in you app/Plugin folder && move tm.css to /webroot/css && move tm.js to /webroot/js
2. load the Plugin in your bootstrap.php ```CakePlugin::load('TimedMessages');```
3. load TimedMessages Component in every Controller u want to use it (or AppController)
```php
public $components = array('TimedMessages.TimedMessage');
```
4. u need to have a minimal Configuration in your apps bootstrap or simply load the plugins via ```CakePlugin::load(array('TimedMessages'=>array('bootstrap'=>true)));```### minimal Configuration
```
Configure::write('TimedMessage',array(
'config'=>array(
'target'=>'',
'direction'=>'append',
),
'default'=>array(
'color'=>'tm-red',//colorClass used
'wait'=>'2',//time to wait till fadeout animation starts
'speed'=>'3',//fadeout animation time
));
```## Instructions
Configuration options:
* TimedMessage
* config
* target: regexp-String without delimeters
* direction: whether the regexp gets appended - ``|messageStuff| or prepended - |messageStuff|``. prepend especially makes sense when using closing regexp like `` or ``You can create an TimedMessage.type Configuration for every type you want:
```php
$this->Session->setFlash('someErrorMessage','default',array(),'error');//type = error
```