Skip to content

Commit

Permalink
bake template improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Oct 11, 2012
1 parent fec9ada commit 2f8b0fc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 143 deletions.
133 changes: 0 additions & 133 deletions Core/Libs/Console/Templates/infinitas/classes/test.ctp

This file was deleted.

12 changes: 6 additions & 6 deletions Core/Libs/Console/Templates/infinitas/views/form.ctp
Expand Up @@ -69,10 +69,10 @@
*
* @copyright Copyright (c) 2009 Carl Sutton (dogmatic69)
*
* @link http://infinitas-cms.org/$plugin
* @package $plugin.views.$action
* @license http://infinitas-cms.org/mit-license The MIT License
* @since $version
* @link http://infinitas-cms.org/$plugin
* @package $plugin.views.$action
* @license http://infinitas-cms.org/mit-license The MIT License
* @since $version
*
* @author $username
*
Expand All @@ -88,11 +88,11 @@ COMMENT;

foreach ($fields as $field) {
if (in_array($field, $possibleFileFields)) {
$fileUpload = ", array('type' => 'file')";
$fileUpload = "null, array('type' => 'file')";
}
}

echo "\techo \$this->Form->create('{$modelClass}'{$fileUpload});\n".
echo "\techo \$this->Form->create({$fileUpload});\n".
"\t\techo \$this->Infinitas->adminEditHead(); ?>\n";
echo "\t\t<fieldset>\n" .
"\t\t\t<h1><?php echo __('" . prettyName($modelClass) . "'); ?></h1><?php\n";
Expand Down
9 changes: 6 additions & 3 deletions Core/Libs/Console/Templates/infinitas/views/index.ctp
Expand Up @@ -47,7 +47,10 @@
);

foreach($fields as $field) {
if ($schema[$field]['type'] == 'text') {
$check = $schema[$field]['type'] == 'text' || (
in_array('created', $fields) && in_array('modified', $fields)
);
if ($check) {
$ignore[] = $field;
}
}
Expand Down Expand Up @@ -78,7 +81,7 @@
*/
COMMENT;
echo "echo \$this->Form->create('$modelClass', array('action' => 'mass'));\n\n".
echo "echo \$this->Form->create(null, array('action' => 'mass'));\n\n".
"\$massActions = \$this->Infinitas->massActionButtons(\n".
"\tarray(\n".
"\t\t'add',\n".
Expand Down Expand Up @@ -175,7 +178,7 @@ COMMENT;
switch($field) {
case 'created':
case 'modified':
$endFields .= "\t\t\t\t\t<td><?php echo CakeTime::niceShort(\${$singularVar}['{$modelClass}']['{$field}']); ?>&nbsp;</td>\n";
$endFields .= "\t\t\t\t\t<td><?php echo \$this->Infinitas->date(\${$singularVar}['{$modelClass}']); ?>&nbsp;</td>\n";
break;

case 'active':
Expand Down
2 changes: 1 addition & 1 deletion Core/Libs/View/Helper/InfinitasHelper.php
Expand Up @@ -120,7 +120,7 @@ public function massActionCheckBox(array $data, $options = array()) {
$options['primaryKey'] = ClassRegistry::init($modelClass)->primaryKey;
}

if(empty($data[$options['alias']]) || empty($data[$options['alias']][$options['primaryKey']])) {
if(empty($data[$options['alias']]) || !isset($data[$options['alias']][$options['primaryKey']])) {
return false;
}

Expand Down

0 comments on commit 2f8b0fc

Please sign in to comment.