mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
updating scaffold view handling
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6181 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
34fb530de5
commit
9f8b4b2cd5
2 changed files with 15 additions and 18 deletions
|
@ -187,7 +187,9 @@ class Scaffold extends Object {
|
||||||
$this->controller->set(compact('modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
|
$this->controller->set(compact('modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
|
||||||
'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations'));
|
'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations'));
|
||||||
|
|
||||||
|
if ($this->controller->view && $this->controller->view !== 'Theme') {
|
||||||
$this->controller->view = 'scaffold';
|
$this->controller->view = 'scaffold';
|
||||||
|
}
|
||||||
$this->__scaffold($params);
|
$this->__scaffold($params);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -365,21 +367,7 @@ class Scaffold extends Object {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __scaffoldError() {
|
function __scaffoldError() {
|
||||||
$pathToViewFile = '';
|
return $this->controller->render('error', $this->layout);
|
||||||
|
|
||||||
if (file_exists(APP . 'views' . DS . $this->viewPath . DS . 'scaffolds' . DS. 'scaffold.error.ctp')) {
|
|
||||||
$pathToViewFile = APP . 'views' . DS . $this->viewPath . DS . 'scaffolds' . DS . 'scaffold.error.ctp';
|
|
||||||
} elseif (file_exists(APP . 'views' . DS . $this->viewPath . DS . 'scaffolds' . DS. 'scaffold.error.thtml')) {
|
|
||||||
$pathToViewFile = APP . 'views' . DS . $this->viewPath . DS . 'scaffolds' . DS . 'scaffold.error.thtml';
|
|
||||||
} elseif (file_exists(APP . 'views' . DS . 'scaffolds' . DS . 'scaffold.error.ctp')) {
|
|
||||||
$pathToViewFile = APP . 'views' . DS . 'scaffolds' . DS . 'scaffold.error.ctp';
|
|
||||||
} elseif (file_exists(APP . 'views' . DS . 'scaffolds' . DS . 'scaffold.error.thtml')) {
|
|
||||||
$pathToViewFile = APP . 'views' . DS . 'scaffolds' . DS . 'scaffold.error.thtml';
|
|
||||||
} else {
|
|
||||||
$pathToViewFile = LIBS . 'view' . DS . 'templates' . DS . 'errors' . DS . 'scaffold_error.ctp';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->controller->render($this->action, $this->layout, $pathToViewFile);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* When methods are now present in a controller
|
* When methods are now present in a controller
|
||||||
|
@ -520,6 +508,10 @@ class ScaffoldView extends ThemeView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($name === 'scaffolds' . DS . $subDir . 'error') {
|
||||||
|
return LIBS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp';
|
||||||
|
}
|
||||||
|
|
||||||
return $this->_missingView($paths[0] . $name . $this->ext, 'missingView');
|
return $this->_missingView($paths[0] . $name . $this->ext, 'missingView');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class TestScaffoldView extends ScaffoldView {
|
||||||
* @package cake.tests
|
* @package cake.tests
|
||||||
* @subpackage cake.tests.cases.libs.controller
|
* @subpackage cake.tests.cases.libs.controller
|
||||||
*/
|
*/
|
||||||
class ScaffoldTest extends CakeTestCase {
|
class ScaffoldViewTest extends CakeTestCase {
|
||||||
|
|
||||||
var $fixtures = array('core.post');
|
var $fixtures = array('core.post');
|
||||||
|
|
||||||
|
@ -67,6 +67,11 @@ class ScaffoldTest extends CakeTestCase {
|
||||||
$result = $ScaffoldView->testGetFilename('index');
|
$result = $ScaffoldView->testGetFilename('index');
|
||||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'index.ctp';
|
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'index.ctp';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
|
$result = $ScaffoldView->testGetFilename('error');
|
||||||
|
$expected = 'cake' . DS . 'libs' . DS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue