From 9d56c4616e9854fe7dba2343e90253fbfc02aee0 Mon Sep 17 00:00:00 2001 From: phpnut Date: Thu, 21 Jun 2007 14:20:21 +0000 Subject: [PATCH] Adding fix for Ticket #2809, fixes Add / Edit scaffolding : Template is always 'edit' instead of $action git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5321 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/controller/scaffold.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cake/libs/controller/scaffold.php b/cake/libs/controller/scaffold.php index 1d03b0e20..64e31701d 100644 --- a/cake/libs/controller/scaffold.php +++ b/cake/libs/controller/scaffold.php @@ -249,7 +249,7 @@ class Scaffold extends Object { * @access private */ function __scaffoldForm($action = 'edit') { - $this->controller->render($action, $this->layout, $this->__getViewFileName('edit')); + $this->controller->render($action, $this->layout, $this->__getViewFileName($action)); } /** * Saves or updates the scaffolded model. @@ -275,7 +275,7 @@ class Scaffold extends Object { } else { return $this->controller->flash(sprintf(__("No id set for %s::edit()", true), Inflector::humanize($this->modelKey)), $this->redirect); } - } else { + } elseif($action == 'edit') { $this->ScaffoldModel->id = $params['pass'][0]; } @@ -506,6 +506,9 @@ class Scaffold extends Object { return $path . $this->viewPath . DS . 'scaffolds' . DS . $this->subDir . $type . $scaffoldAction . '.thtml'; } } + if($action === 'add') { + $action = 'edit'; + } return LIBS . 'view' . DS . 'templates' . DS . 'scaffolds' . DS . $action . '.ctp'; } }