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
This commit is contained in:
phpnut 2007-06-21 14:20:21 +00:00
parent cbbf006bd6
commit 9d56c4616e

View file

@ -249,7 +249,7 @@ class Scaffold extends Object {
* @access private * @access private
*/ */
function __scaffoldForm($action = 'edit') { 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. * Saves or updates the scaffolded model.
@ -275,7 +275,7 @@ class Scaffold extends Object {
} else { } else {
return $this->controller->flash(sprintf(__("No id set for %s::edit()", true), Inflector::humanize($this->modelKey)), $this->redirect); 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]; $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'; 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'; return LIBS . 'view' . DS . 'templates' . DS . 'scaffolds' . DS . $action . '.ctp';
} }
} }