Browse Source

Update bake templates to use default flash templates

Bryan Crowe 11 years ago
parent
commit
2bc0549fcf

+ 6 - 6
src/Console/Templates/default/actions/controller_actions.ctp

@@ -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
@@ -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
@@ -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']);
 	}

+ 6 - 6
tests/bake_compare/Controller/Actions.ctp

@@ -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');
@@ -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');
@@ -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']);
 	}