Skip to content

Commit

Permalink
Moved view files under "Template" folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Jan 14, 2014
1 parent cc2fcf7 commit dc68840
Show file tree
Hide file tree
Showing 126 changed files with 55 additions and 55 deletions.
12 changes: 6 additions & 6 deletions src/Core/App.php
Expand Up @@ -25,9 +25,9 @@
*
* ### Adding paths
*
* Additional paths for Views and Plugins are configured with Configure now. See App/Config/app.php for an
* example. The `App.paths.plugins` and `App.paths.views` variables are used to configure paths for plugins
* and views respectively. All class based resources should be mapped using your application's autoloader.
* Additional paths for Templates and Plugins are configured with Configure now. See App/Config/app.php for an
* example. The `App.paths.plugins` and `App.paths.templates` variables are used to configure paths for plugins
* and templates respectively. All class based resources should be mapped using your application's autoloader.
*
* ### Inspecting loaded paths
*
Expand Down Expand Up @@ -139,8 +139,8 @@ public static function path($type, $plugin = null) {
if ($type === 'Plugin') {
return (array)Configure::read('App.paths.plugins');
}
if (empty($plugin) && $type === 'View') {
return (array)Configure::read('App.paths.views');
if (empty($plugin) && $type === 'Template') {
return (array)Configure::read('App.paths.templates');
}
if (!empty($plugin)) {
return [static::pluginPath($plugin) . $type . DS];
Expand Down Expand Up @@ -178,7 +178,7 @@ public static function pluginPath($plugin) {
*/
public static function themePath($theme) {
$themeDir = 'Themed' . DS . Inflector::camelize($theme);
$paths = static::path('View');
$paths = static::path('Template');
foreach ($paths as $path) {
if (is_dir($path . $themeDir)) {
return $path . $themeDir . DS;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions src/View/View.php
Expand Up @@ -369,7 +369,7 @@ public function setEventManager(EventManager $eventManager) {
* This realizes the concept of Elements, (or "partial layouts") and the $params array is used to send
* data to be used in the element. Elements can be cached improving performance by using the `cache` option.
*
* @param string $name Name of template file in the/app/View/Element/ folder,
* @param string $name Name of template file in the/app/Template/Element/ folder,
* or `MyPlugin.template` to use the template element from MyPlugin. If the element
* is not found in the plugin, the normal view path cascade will be searched.
* @param array $data Array of data to be made available to the rendered view (i.e. the Element)
Expand Down Expand Up @@ -413,7 +413,7 @@ public function element($name, $data = array(), $options = array()) {
/**
* Checks if an element exists
*
* @param string $name Name of template file in the /app/View/Element/ folder,
* @param string $name Name of template file in the /app/Template/Element/ folder,
* or `MyPlugin.template` to check the template element from MyPlugin. If the element
* is not found in the plugin, the normal view path cascade will be searched.
* @return boolean Success
Expand Down Expand Up @@ -1038,8 +1038,8 @@ protected function _paths($plugin = null, $cached = true) {
return $this->_paths;
}
$paths = array();
$viewPaths = App::path('View');
$corePaths = App::core('View');
$viewPaths = App::path('Template');
$corePaths = App::core('Template');

if (!empty($plugin)) {
$count = count($viewPaths);
Expand All @@ -1048,7 +1048,7 @@ protected function _paths($plugin = null, $cached = true) {
$paths[] = $viewPaths[$i] . 'Plugin' . DS . $plugin . DS;
}
}
$paths = array_merge($paths, App::path('View', $plugin));
$paths = array_merge($paths, App::path('Template', $plugin));

This comment has been minimized.

Copy link
@josephzidell

josephzidell Jan 17, 2014

This breaks a working app. With this change, I get a 500 error (actually, cannot find the 500 error!), but when I change it back to 'View', it works.

This comment has been minimized.

Copy link
@markstory

markstory Jan 17, 2014

Member

We're still pre-alpha things are going to break possibly often.

This comment has been minimized.

Copy link
@josephzidell

josephzidell Jan 17, 2014

That's why I'm trying it out and mentioning these bugs :)

This comment has been minimized.

Copy link
@markstory

markstory Jan 17, 2014

Member

Its not a bug, the code just changed. You might need to update/rebuild your application skeleton.

}

$paths = array_unique(array_merge($paths, $viewPaths));
Expand Down
10 changes: 5 additions & 5 deletions tests/TestCase/Console/Command/Task/ExtractTaskTest.php
Expand Up @@ -72,7 +72,7 @@ public function tearDown() {
public function testExecute() {
$this->Task->interactive = false;

$this->Task->params['paths'] = TEST_APP . 'TestApp/View/Pages';
$this->Task->params['paths'] = TEST_APP . 'TestApp/Template/Pages';
$this->Task->params['output'] = $this->path . DS;
$this->Task->params['extract-core'] = 'no';
$this->Task->expects($this->never())->method('err');
Expand Down Expand Up @@ -131,7 +131,7 @@ public function testExecute() {
public function testExtractCategory() {
$this->Task->interactive = false;

$this->Task->params['paths'] = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Pages';
$this->Task->params['paths'] = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages';
$this->Task->params['output'] = $this->path . DS;
$this->Task->params['extract-core'] = 'no';
$this->Task->params['merge'] = 'no';
Expand All @@ -156,7 +156,7 @@ public function testExtractCategory() {
public function testExtractWithExclude() {
$this->Task->interactive = false;

$this->Task->params['paths'] = TEST_APP . 'TestApp/View';
$this->Task->params['paths'] = TEST_APP . 'TestApp/Template';
$this->Task->params['output'] = $this->path . DS;
$this->Task->params['exclude'] = 'Pages,Layout';
$this->Task->params['extract-core'] = 'no';
Expand Down Expand Up @@ -184,8 +184,8 @@ public function testExtractMultiplePaths() {
$this->Task->interactive = false;

$this->Task->params['paths'] =
TEST_APP . 'TestApp/View/Pages,' .
TEST_APP . 'TestApp/View/Posts';
TEST_APP . 'TestApp/Template/Pages,' .
TEST_APP . 'TestApp/Template/Posts';

$this->Task->params['output'] = $this->path . DS;
$this->Task->params['extract-core'] = 'no';
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Core/AppTest.php
Expand Up @@ -259,11 +259,11 @@ public function testPluginPath() {
*/
public function testThemePath() {
$path = App::themePath('test_theme');
$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS;
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Themed' . DS . 'TestTheme' . DS;
$this->assertEquals($expected, $path);

$path = App::themePath('TestTheme');
$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS;
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Themed' . DS . 'TestTheme' . DS;
$this->assertEquals($expected, $path);
}

Expand Down
14 changes: 7 additions & 7 deletions tests/TestCase/Routing/DispatcherTest.php
Expand Up @@ -757,31 +757,31 @@ public static function assetProvider() {
return array(
array(
'theme/test_theme/flash/theme_test.swf',
'TestApp/View/Themed/TestTheme/webroot/flash/theme_test.swf'
'TestApp/Template/Themed/TestTheme/webroot/flash/theme_test.swf'
),
array(
'theme/test_theme/pdfs/theme_test.pdf',
'TestApp/View/Themed/TestTheme/webroot/pdfs/theme_test.pdf'
'TestApp/Template/Themed/TestTheme/webroot/pdfs/theme_test.pdf'
),
array(
'theme/test_theme/img/test.jpg',
'TestApp/View/Themed/TestTheme/webroot/img/test.jpg'
'TestApp/Template/Themed/TestTheme/webroot/img/test.jpg'
),
array(
'theme/test_theme/css/test_asset.css',
'TestApp/View/Themed/TestTheme/webroot/css/test_asset.css'
'TestApp/Template/Themed/TestTheme/webroot/css/test_asset.css'
),
array(
'theme/test_theme/js/theme.js',
'TestApp/View/Themed/TestTheme/webroot/js/theme.js'
'TestApp/Template/Themed/TestTheme/webroot/js/theme.js'
),
array(
'theme/test_theme/js/one/theme_one.js',
'TestApp/View/Themed/TestTheme/webroot/js/one/theme_one.js'
'TestApp/Template/Themed/TestTheme/webroot/js/one/theme_one.js'
),
array(
'theme/test_theme/space%20image.text',
'TestApp/View/Themed/TestTheme/webroot/space image.text'
'TestApp/Template/Themed/TestTheme/webroot/space image.text'
),
array(
'test_plugin/root.js',
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/View/HelperTest.php
Expand Up @@ -858,7 +858,7 @@ public function testWebrootPaths() {
$this->assertEquals($expected, $result);

$webRoot = Configure::read('App.www_root');
Configure::write('App.www_root', CAKE . 'Test/TestApp/webroot/');
Configure::write('App.www_root', TEST_APP . 'TestApp/webroot/');

$result = $this->Helper->webroot('/img/cake.power.gif');
$expected = '/theme/test_theme/img/cake.power.gif';
Expand Down
56 changes: 28 additions & 28 deletions tests/TestCase/View/ViewTest.php
Expand Up @@ -308,25 +308,25 @@ public function testGetTemplate() {

$ThemeView = new TestThemeView($this->Controller);
$ThemeView->theme = 'TestTheme';
$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Pages' . DS . 'home.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages' . DS . 'home.ctp';
$result = $ThemeView->getViewFileName('home');
$this->assertEquals($expected, $result);

$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS . 'index.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS . 'index.ctp';
$result = $ThemeView->getViewFileName('/Posts/index');
$this->assertEquals($expected, $result);

$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layout' . DS . 'default.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layout' . DS . 'default.ctp';
$result = $ThemeView->getLayoutFileName();
$this->assertEquals($expected, $result);

$ThemeView->layoutPath = 'rss';
$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Layout' . DS . 'rss' . DS . 'default.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'rss' . DS . 'default.ctp';
$result = $ThemeView->getLayoutFileName();
$this->assertEquals($expected, $result);

$ThemeView->layoutPath = 'Email' . DS . 'html';
$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Layout' . DS . 'Email' . DS . 'html' . DS . 'default.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'Email' . DS . 'html' . DS . 'default.ctp';
$result = $ThemeView->getLayoutFileName();
$this->assertEquals($expected, $result);
}
Expand All @@ -344,11 +344,11 @@ public function testPluginGetTemplate() {

$View = new TestView($this->Controller);

$expected = Plugin::path('TestPlugin') . 'View' . DS . 'Tests' . DS . 'index.ctp';
$expected = Plugin::path('TestPlugin') . 'Template' . DS . 'Tests' . DS . 'index.ctp';
$result = $View->getViewFileName('index');
$this->assertEquals($expected, $result);

$expected = Plugin::path('TestPlugin') . 'View' . DS . 'Layout' . DS . 'default.ctp';
$expected = Plugin::path('TestPlugin') . 'Template' . DS . 'Layout' . DS . 'default.ctp';
$result = $View->getLayoutFileName();
$this->assertEquals($expected, $result);
}
Expand All @@ -366,7 +366,7 @@ public function testPluginThemedGetTemplate() {
$this->Controller->theme = 'TestTheme';

$ThemeView = new TestThemeView($this->Controller);
$themePath = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS;
$themePath = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Themed' . DS . 'TestTheme' . DS;

$expected = $themePath . 'Plugin' . DS . 'TestPlugin' . DS . 'Tests' . DS . 'index.ctp';
$result = $ThemeView->getViewFileName('index');
Expand Down Expand Up @@ -394,16 +394,16 @@ public function testPluginPathGeneration() {

$View = new TestView($this->Controller);
$paths = $View->paths();
$expected = array_merge(App::path('View'), App::core('View'));
$expected = array_merge(App::path('Template'), App::core('Template'));
$this->assertEquals($expected, $paths);

$paths = $View->paths('TestPlugin');
$pluginPath = Plugin::path('TestPlugin');
$expected = array(
TEST_APP . 'TestApp' . DS . 'View' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
$pluginPath . 'View' . DS,
TEST_APP . 'TestApp' . DS . 'View' . DS,
CAKE . 'View' . DS,
TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Plugin' . DS . 'TestPlugin' . DS,
$pluginPath . 'Template' . DS,
TEST_APP . 'TestApp' . DS . 'Template' . DS,
CAKE . 'Template' . DS,
);
$this->assertEquals($expected, $paths);
}
Expand All @@ -422,11 +422,11 @@ public function testCamelCasePluginGetTemplate() {
$View = new TestView($this->Controller);

$pluginPath = Plugin::path('TestPlugin');
$expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'index.ctp';
$expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'Template' . DS . 'Tests' . DS . 'index.ctp';
$result = $View->getViewFileName('index');
$this->assertEquals($expected, $result);

$expected = $pluginPath . 'View' . DS . 'Layout' . DS . 'default.ctp';
$expected = $pluginPath . 'Template' . DS . 'Layout' . DS . 'default.ctp';
$result = $View->getLayoutFileName();
$this->assertEquals($expected, $result);
}
Expand All @@ -445,29 +445,29 @@ public function testGetViewFileNames() {

$View = new TestView($this->Controller);

$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Pages' . DS . 'home.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages' . DS . 'home.ctp';
$result = $View->getViewFileName('home');
$this->assertEquals($expected, $result);

$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Posts' . DS . 'index.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . 'index.ctp';
$result = $View->getViewFileName('/Posts/index');
$this->assertEquals($expected, $result);

$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Posts' . DS . 'index.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . 'index.ctp';
$result = $View->getViewFileName('../Posts/index');
$this->assertEquals($expected, $result);

$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Pages' . DS . 'page.home.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages' . DS . 'page.home.ctp';
$result = $View->getViewFileName('page.home');
$this->assertEquals($expected, $result, 'Should not ruin files with dots.');

Plugin::load('TestPlugin');
$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Pages' . DS . 'home.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages' . DS . 'home.ctp';
$result = $View->getViewFileName('TestPlugin.home');
$this->assertEquals($expected, $result, 'Plugin is missing the view, cascade to app.');

$View->viewPath = 'Tests';
$expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'index.ctp';
$expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'Template' . DS . 'Tests' . DS . 'index.ctp';
$result = $View->getViewFileName('TestPlugin.index');
$this->assertEquals($expected, $result);
}
Expand All @@ -485,17 +485,17 @@ public function testGetLayoutFileName() {

$View = new TestView($this->Controller);

$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Layout' . DS . 'default.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'default.ctp';
$result = $View->getLayoutFileName();
$this->assertEquals($expected, $result);

$View->layoutPath = 'rss';
$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Layout' . DS . 'rss' . DS . 'default.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'rss' . DS . 'default.ctp';
$result = $View->getLayoutFileName();
$this->assertEquals($expected, $result);

$View->layoutPath = 'Email' . DS . 'html';
$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Layout' . DS . 'Email' . DS . 'html' . DS . 'default.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'Email' . DS . 'html' . DS . 'default.ctp';
$result = $View->getLayoutFileName();
$this->assertEquals($expected, $result);
}
Expand All @@ -514,12 +514,12 @@ public function testGetLayoutFileNamePlugin() {
$View = new TestView($this->Controller);
Plugin::load('TestPlugin');

$expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Layout' . DS . 'default.ctp';
$expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'Template' . DS . 'Layout' . DS . 'default.ctp';
$result = $View->getLayoutFileName('TestPlugin.default');
$this->assertEquals($expected, $result);

$View->plugin = 'TestPlugin';
$expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Layout' . DS . 'default.ctp';
$expected = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS . 'Template' . DS . 'Layout' . DS . 'default.ctp';
$result = $View->getLayoutFileName('default');
$this->assertEquals($expected, $result);
}
Expand Down Expand Up @@ -1042,7 +1042,7 @@ public function testGetViewFileNameSubdirWithPluginAndViewPath() {
$pluginPath = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS;

$result = $View->getViewFileName('sub_dir/sub_element');
$expected = $pluginPath . 'View' . DS . 'Element' . DS . 'sub_dir' . DS . 'sub_element.ctp';
$expected = $pluginPath . 'Template' . DS . 'Element' . DS . 'sub_dir' . DS . 'sub_element.ctp';
$this->assertEquals($expected, $result);
}

Expand Down Expand Up @@ -1086,7 +1086,7 @@ public function testViewFileName() {
$result = $View->getViewFileName('../Themed/TestTheme/Posts/index');
$this->assertRegExp('/Themed(\/|\\\)TestTheme(\/|\\\)Posts(\/|\\\)index.ctp/', $result);

$expected = TEST_APP . 'TestApp' . DS . 'View' . DS . 'Posts' . DS . 'index.ctp';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . 'index.ctp';
$result = $View->getViewFileName('../Posts/index');
$this->assertEquals($expected, $result);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/init.php
Expand Up @@ -79,7 +79,7 @@
'cssBaseUrl' => 'css/',
'paths' => [
'plugins' => [TEST_APP . 'Plugin/'],
'views' => [APP . 'View/']
'templates' => [APP . 'Template/']
]
]);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit dc68840

Please sign in to comment.