Permalink
Browse files

Applying patch from 'majna'. Adding plugin to the list of template va…

…riables exposed in the controller task. Test added Fixes #1077
  • Loading branch information...
markstory committed Sep 3, 2010
1 parent dbdd17f commit 5c0fe1b16e1635d7a3bdf60b43c90aae20665060
@@ -275,8 +275,9 @@ function _askAboutMethods() {
*/
function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
$currentModelName = $modelImport = $this->_modelName($controllerName);
- if ($this->plugin) {
- $modelImport = $this->plugin . '.' . $modelImport;
+ $plugin = $this->plugin;
+ if ($plugin) {
+ $modelImport = $plugin . '.' . $modelImport;
}
if (!App::import('Model', $modelImport)) {
$this->err(__('You must have a model for this class to build basic methods. Please try again.', true));
@@ -290,7 +291,7 @@ function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
$singularHumanName = $this->_singularHumanName($controllerName);
$pluralHumanName = $this->_pluralName($controllerName);
- $this->Template->set(compact('admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName',
+ $this->Template->set(compact('plugin', 'admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName',
'pluralHumanName', 'modelObj', 'wannaUseSession', 'currentModelName'));
$actions = $this->Template->generate('actions', 'controller_actions');
return $actions;
@@ -299,6 +299,8 @@ function testBakeWithPlugin() {
$this->Task->expectAt(1, 'createFile', array(
$path, new PatternExpectation('/ArticlesController extends ControllerTestAppController/')));
$this->Task->bake('Articles', '--actions--', array(), array(), array());
+
+ $this->assertEqual($this->Task->Template->templateVars['plugin'], 'ControllerTest');
}
/**

0 comments on commit 5c0fe1b

Please sign in to comment.