Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cakephp 2.7's FlashComponent requires flash elements to be in subdir Elements/Flash. #79

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Controller/BoostCakeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public function index() {
* @return void
*/
public function bootstrap2() {
$this->Session->setFlash(__('Alert notice message testing...'), 'alert', array(
$this->Flash->alert(__('Alert notice message testing...'), 'alert', array(
'plugin' => 'BoostCake',
), 'notice');
$this->Session->setFlash(__('Alert success message testing...'), 'alert', array(
$this->Flash->alert(__('Alert success message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-success'
'params' => ['class' => 'alert-success']
), 'success');
$this->Session->setFlash(__('Alert error message testing...'), 'alert', array(
$this->Flash->alert(__('Alert error message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-error'
), 'error');
Expand All @@ -59,19 +59,19 @@ public function bootstrap2() {
* @return void
*/
public function bootstrap3() {
$this->Session->setFlash(__('Alert success message testing...'), 'alert', array(
$this->Flash->alert(__('Alert success message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-success'
'params' => ['class' => 'alert-success']
), 'success');
$this->Session->setFlash(__('Alert info message testing...'), 'alert', array(
$this->Flash->alert(__('Alert info message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-info'
), 'info');
$this->Session->setFlash(__('Alert warning message testing...'), 'alert', array(
$this->Flash->alert(__('Alert warning message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-warning'
'params' => ['class' => 'alert-danger'],
), 'warning');
$this->Session->setFlash(__('Alert danger message testing...'), 'alert', array(
$this->Flash->alert(__('Alert danger message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-danger'
), 'danger');
Expand Down
17 changes: 17 additions & 0 deletions View/Elements/Flash/alert.ctp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
if (isset($params['class'])) {
$class = $params['class'];
}
if (!isset($class)) {
$class = false;
}
if (!isset($close)) {
$close = true;
}
?>
<div class="alert<?php echo ($class) ? ' ' . $class : null; ?>">
<?php if ($close): ?>
<a class="close" data-dismiss="alert" href="#">×</a>
<?php endif; ?>
<?php echo $message; ?>
</div>
14 changes: 0 additions & 14 deletions View/Elements/alert.ctp

This file was deleted.

1 change: 1 addition & 0 deletions View/Elements/alert.ctp
8 changes: 4 additions & 4 deletions View/Elements/bootstrap2/alerts.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
echo $this->Session->flash();

// Controller
$this->Session->setFlash(__('Alert notice message testing...'), 'alert', array(
$this->Flash->alert(__('Alert notice message testing...'), 'alert', array(
'plugin' => 'BoostCake',
));

$this->Session->setFlash(__('Alert success message testing...'), 'alert', array(
$this->Flash->alert(__('Alert success message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-success'
'params' => ['class' => 'alert-success']
));

$this->Session->setFlash(__('Alert error message testing...'), 'alert', array(
$this->Flash->alert(__('Alert error message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-error'
));
Expand Down
12 changes: 6 additions & 6 deletions View/Elements/bootstrap3/alerts.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
echo $this->Session->flash();

// Controller
$this->Session->setFlash(__('Alert success message testing...'), 'alert', array(
$this->Flash->alert(__('Alert success message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-success'
'params' => ['class' => 'alert-success']
));

$this->Session->setFlash(__('Alert info message testing...'), 'alert', array(
$this->Flash->alert(__('Alert info message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-info'
));

$this->Session->setFlash(__('Alert warning message testing...'), 'alert', array(
$this->Flash->alert(__('Alert warning message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-warning'
'params' => ['class' => 'alert-danger'],
));

$this->Session->setFlash(__('Alert danger message testing...'), 'alert', array(
$this->Flash->alert(__('Alert danger message testing...'), 'alert', array(
'plugin' => 'BoostCake',
'class' => 'alert-danger'
));
Expand Down