Skip to content

Commit

Permalink
Update bake templates to use default flash templates
Browse files Browse the repository at this point in the history
  • Loading branch information
bcrowe committed Jun 15, 2014
1 parent dbbd037 commit 2bc0549
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/Console/Templates/default/actions/controller_actions.ctp
Expand Up @@ -72,10 +72,10 @@ $allAssociations = array_merge(
$<?= $singularName ?> = $this-><?= $currentModelName ?>->newEntity($this->request->data);
if ($this->request->is('post')) {
if ($this-><?= $currentModelName; ?>->save($<?= $singularName ?>)) {
$this->Session->setFlash(__('The <?= strtolower($singularHumanName); ?> has been saved.'));
$this->Flash->success('The <?= strtolower($singularHumanName); ?> has been saved.');
return $this->redirect(['action' => 'index']);
} else {
$this->Session->setFlash(__('The <?= strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
$this->Flash->error('The <?= strtolower($singularHumanName); ?> could not be saved. Please, try again.');
}
}
<?php
Expand Down Expand Up @@ -105,10 +105,10 @@ $allAssociations = array_merge(
if ($this->request->is(['post', 'put'])) {
$<?= $singularName ?> = $this-><?= $currentModelName ?>->patchEntity($<?= $singularName ?>, $this->request->data);
if ($this-><?= $currentModelName; ?>->save($<?= $singularName ?>)) {
$this->Session->setFlash(__('The <?= strtolower($singularHumanName); ?> has been saved.'));
$this->Flash->success('The <?= strtolower($singularHumanName); ?> has been saved.');
return $this->redirect(['action' => 'index']);
} else {
$this->Session->setFlash(__('The <?= strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
$this->Flash->error('The <?= strtolower($singularHumanName); ?> could not be saved. Please, try again.');
}
}
<?php
Expand All @@ -134,9 +134,9 @@ $allAssociations = array_merge(
$<?= $singularName ?> = $this-><?= $currentModelName ?>->get($id);
$this->request->allowMethod('post', 'delete');
if ($this-><?= $currentModelName; ?>->delete($<?= $singularName ?>)) {
$this->Session->setFlash(__('The <?= strtolower($singularHumanName); ?> has been deleted.'));
$this->Flash->success('The <?= strtolower($singularHumanName); ?> has been deleted.');
} else {
$this->Session->setFlash(__('The <?= strtolower($singularHumanName); ?> could not be deleted. Please, try again.'));
$this->Flash->error('The <?= strtolower($singularHumanName); ?> could not be deleted. Please, try again.');
}
return $this->redirect(['action' => 'index']);
}
12 changes: 6 additions & 6 deletions tests/bake_compare/Controller/Actions.ctp
Expand Up @@ -34,10 +34,10 @@
$bakeArticle = $this->BakeArticles->newEntity($this->request->data);
if ($this->request->is('post')) {
if ($this->BakeArticles->save($bakeArticle)) {
$this->Session->setFlash(__('The bake article has been saved.'));
$this->Flash->success('The bake article has been saved.');
return $this->redirect(['action' => 'index']);
} else {
$this->Session->setFlash(__('The bake article could not be saved. Please, try again.'));
$this->Flash->error('The bake article could not be saved. Please, try again.');
}
}
$bakeUsers = $this->BakeArticles->BakeUsers->find('list');
Expand All @@ -59,10 +59,10 @@
if ($this->request->is(['post', 'put'])) {
$bakeArticle = $this->BakeArticles->patchEntity($bakeArticle, $this->request->data);
if ($this->BakeArticles->save($bakeArticle)) {
$this->Session->setFlash(__('The bake article has been saved.'));
$this->Flash->success('The bake article has been saved.');
return $this->redirect(['action' => 'index']);
} else {
$this->Session->setFlash(__('The bake article could not be saved. Please, try again.'));
$this->Flash->error('The bake article could not be saved. Please, try again.');
}
}
$bakeUsers = $this->BakeArticles->BakeUsers->find('list');
Expand All @@ -81,9 +81,9 @@
$bakeArticle = $this->BakeArticles->get($id);
$this->request->allowMethod('post', 'delete');
if ($this->BakeArticles->delete($bakeArticle)) {
$this->Session->setFlash(__('The bake article has been deleted.'));
$this->Flash->success('The bake article has been deleted.');
} else {
$this->Session->setFlash(__('The bake article could not be deleted. Please, try again.'));
$this->Flash->error('The bake article could not be deleted. Please, try again.');
}
return $this->redirect(['action' => 'index']);
}

0 comments on commit 2bc0549

Please sign in to comment.