mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
updating bake and css, also added a name key to the generateFieldNames
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4300 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
6257689e0d
commit
0c2579c565
4 changed files with 39 additions and 16 deletions
|
@ -136,6 +136,15 @@ td.actions a {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Paging */
|
||||||
|
div.paging {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
div.paging div.disabled {
|
||||||
|
color: #ddd;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
/* Scaffold View */
|
/* Scaffold View */
|
||||||
dl {
|
dl {
|
||||||
line-height: 2em;
|
line-height: 2em;
|
||||||
|
|
|
@ -663,6 +663,7 @@ class Controller extends Object {
|
||||||
$fieldNames[$column['name']]['prompt'] = $fieldNames[$column['name']]['label'];
|
$fieldNames[$column['name']]['prompt'] = $fieldNames[$column['name']]['label'];
|
||||||
}
|
}
|
||||||
$fieldNames[$column['name']]['tagName'] = $model . '/' . $column['name'];
|
$fieldNames[$column['name']]['tagName'] = $model . '/' . $column['name'];
|
||||||
|
$fieldNames[$column['name']]['name'] = $column['name'];
|
||||||
$fieldNames[$column['name']]['class'] = 'optional';
|
$fieldNames[$column['name']]['class'] = 'optional';
|
||||||
$validationFields = $modelObj->validate;
|
$validationFields = $modelObj->validate;
|
||||||
if (isset($validationFields[$column['name']])) {
|
if (isset($validationFields[$column['name']])) {
|
||||||
|
@ -766,6 +767,7 @@ class Controller extends Object {
|
||||||
$fieldNames[$otherModelKey]['type'] = "select";
|
$fieldNames[$otherModelKey]['type'] = "select";
|
||||||
$fieldNames[$otherModelKey]['multiple'] = "multiple";
|
$fieldNames[$otherModelKey]['multiple'] = "multiple";
|
||||||
$fieldNames[$otherModelKey]['tagName'] = $associationName . '/' . $associationName;
|
$fieldNames[$otherModelKey]['tagName'] = $associationName . '/' . $associationName;
|
||||||
|
$fieldNames[$otherModelKey]['name'] = $associationName;
|
||||||
$fieldNames[$otherModelKey]['class'] = 'optional';
|
$fieldNames[$otherModelKey]['class'] = 'optional';
|
||||||
$fieldNames[$otherModelKey]['options'] = $otherModelObj->generateList();
|
$fieldNames[$otherModelKey]['options'] = $otherModelObj->generateList();
|
||||||
if (isset($data[$associationName])) {
|
if (isset($data[$associationName])) {
|
||||||
|
|
|
@ -800,9 +800,10 @@ class Bake {
|
||||||
if (intval($enteredController) > 0 && intval($enteredController) <= count($this->__controllerNames) ) {
|
if (intval($enteredController) > 0 && intval($enteredController) <= count($this->__controllerNames) ) {
|
||||||
$controllerName = $this->__controllerNames[intval($enteredController) - 1];
|
$controllerName = $this->__controllerNames[intval($enteredController) - 1];
|
||||||
} else {
|
} else {
|
||||||
$controllerName = $enteredController;
|
$controllerName = Inflector::camelize($enteredController);
|
||||||
}
|
}
|
||||||
$controllerPath = $this->__controllerPath($controllerName);
|
|
||||||
|
$controllerPath = low(Inflector::underscore($controllerName));
|
||||||
|
|
||||||
$doItInteractive = $this->getInput("Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite {$controllerClassName} views if it exist.", array('y','n'), 'y');
|
$doItInteractive = $this->getInput("Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite {$controllerClassName} views if it exist.", array('y','n'), 'y');
|
||||||
|
|
||||||
|
@ -921,7 +922,7 @@ class Bake {
|
||||||
$indexView .= "<table cellpadding=\"0\" cellspacing=\"0\">\n";
|
$indexView .= "<table cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||||
$indexView .= "\t<tr>\n";
|
$indexView .= "\t<tr>\n";
|
||||||
foreach ($fieldNames as $fieldName) {
|
foreach ($fieldNames as $fieldName) {
|
||||||
$indexView .= "\t\t<th>".$fieldName['prompt']."</th>\n";
|
$indexView .= "\t\t<th><?php echo \$paginator->sort('{$fieldName['name']}');?></th>\n";
|
||||||
}
|
}
|
||||||
$indexView .= "\t\t<th>Actions</th>\n";
|
$indexView .= "\t\t<th>Actions</th>\n";
|
||||||
$indexView .= "\t</tr>\n";
|
$indexView .= "\t</tr>\n";
|
||||||
|
@ -937,7 +938,7 @@ class Bake {
|
||||||
$otherControllerPath = $this->__controllerPath($otherControllerName);
|
$otherControllerPath = $this->__controllerPath($otherControllerName);
|
||||||
if(is_object($otherModelObj)) {
|
if(is_object($otherModelObj)) {
|
||||||
$displayField = $otherModelObj->getDisplayField();
|
$displayField = $otherModelObj->getDisplayField();
|
||||||
$indexView .= "\t\t<td> <?php echo \$html->link(\$".$singularName."['{$otherModelName}']['{$displayField}'], array('controller'=> '{$otherControllerPath}', 'action'=>'view', \$".$singularName."['{$otherModelName}']['{$otherModelObj->primaryKey}'])); ?></td>\n";
|
$indexView .= "\t\t<td><?php echo \$html->link(\$".$singularName."['{$otherModelName}']['{$displayField}'], array('controller'=> '{$otherControllerPath}', 'action'=>'view', \$".$singularName."['{$otherModelName}']['{$otherModelObj->primaryKey}'])); ?></td>\n";
|
||||||
} else {
|
} else {
|
||||||
$indexView .= "\t\t<td><?php echo \$".$singularName."['{$modelObj->name}']['{$field}']; ?></td>\n";
|
$indexView .= "\t\t<td><?php echo \$".$singularName."['{$modelObj->name}']['{$field}']; ?></td>\n";
|
||||||
}
|
}
|
||||||
|
@ -954,8 +955,11 @@ class Bake {
|
||||||
$indexView .= "\t</tr>\n";
|
$indexView .= "\t</tr>\n";
|
||||||
$indexView .= "<?php endforeach; ?>\n";
|
$indexView .= "<?php endforeach; ?>\n";
|
||||||
$indexView .= "</table>\n\n";
|
$indexView .= "</table>\n\n";
|
||||||
$indexView .= "<?php echo \$paginator->prev(); ?> |\n";
|
$indexView .= "</div>\n";
|
||||||
$indexView .= "<?php echo \$paginator->next(); ?>\n\n";
|
$indexView .= "<div class=\"paging\">\n";
|
||||||
|
$indexView .= "<?php echo \$paginator->prev('<< previous', array(), null, array('class'=>'disabled'));?>\n";
|
||||||
|
$indexView .= "|\n";
|
||||||
|
$indexView .= "<?php echo \$paginator->next('next >>', array(), null, array('class'=>'disabled'));?>\n";
|
||||||
$indexView .= "</div>\n";
|
$indexView .= "</div>\n";
|
||||||
$indexView .= "<div class=\"actions\">\n";
|
$indexView .= "<div class=\"actions\">\n";
|
||||||
$indexView .= "\t<ul>\n";
|
$indexView .= "\t<ul>\n";
|
||||||
|
@ -1180,9 +1184,9 @@ class Bake {
|
||||||
unset($formOptions['type']);
|
unset($formOptions['type']);
|
||||||
$fieldOptions = $this->__pluralName($options['model']);
|
$fieldOptions = $this->__pluralName($options['model']);
|
||||||
unset($options['options']);
|
unset($options['options']);
|
||||||
//$formOptions['options'] = "'options' => \${$fieldOptions}";
|
$formOptions['options'] = "'options' => \${$fieldOptions}";
|
||||||
if(isset($options['multiple'])){
|
if(isset($options['multiple'])){
|
||||||
//$formOptions['multiple'] = "'multiple' => 'multiple'";
|
$formOptions['multiple'] = "'multiple' => 'multiple'";
|
||||||
$tagName = $tagName.'/'.$tagName;
|
$tagName = $tagName.'/'.$tagName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1440,7 +1444,6 @@ class Bake {
|
||||||
if (low($wannaUseSession) == 'y' || low($wannaUseSession) == 'yes') {
|
if (low($wannaUseSession) == 'y' || low($wannaUseSession) == 'yes') {
|
||||||
$actions .= "\t\t\t\t\$this->Session->setFlash('The ".$singularHumanName." has been saved');\n";
|
$actions .= "\t\t\t\t\$this->Session->setFlash('The ".$singularHumanName." has been saved');\n";
|
||||||
$actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n";
|
$actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n";
|
||||||
$actions .= "\t\t\t\texit();\n";
|
|
||||||
} else {
|
} else {
|
||||||
$actions .= "\t\t\t\t\$this->flash('{$currentModelName} saved.', array('action'=>'index'));\n";
|
$actions .= "\t\t\t\t\$this->flash('{$currentModelName} saved.', array('action'=>'index'));\n";
|
||||||
$actions .= "\t\t\t\texit();\n";
|
$actions .= "\t\t\t\texit();\n";
|
||||||
|
@ -1483,8 +1486,8 @@ class Bake {
|
||||||
$actions .= "\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n";
|
$actions .= "\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n";
|
||||||
} else {
|
} else {
|
||||||
$actions .= "\t\t\t\$this->flash('Invalid {$singularHumanName}', array('action'=>'index'));\n";
|
$actions .= "\t\t\t\$this->flash('Invalid {$singularHumanName}', array('action'=>'index'));\n";
|
||||||
}
|
|
||||||
$actions .= "\t\t\texit();\n";
|
$actions .= "\t\t\texit();\n";
|
||||||
|
}
|
||||||
$actions .= "\t\t}\n";
|
$actions .= "\t\t}\n";
|
||||||
$actions .= "\t\tif(!empty(\$this->data)) {\n";
|
$actions .= "\t\tif(!empty(\$this->data)) {\n";
|
||||||
$actions .= "\t\t\t\$this->cleanUpFields();\n";
|
$actions .= "\t\t\t\$this->cleanUpFields();\n";
|
||||||
|
@ -1494,8 +1497,8 @@ class Bake {
|
||||||
$actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n";
|
$actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n";
|
||||||
} else {
|
} else {
|
||||||
$actions .= "\t\t\t\t\$this->flash('The ".$singularHumanName." saved.', array('action'=>'index'));\n";
|
$actions .= "\t\t\t\t\$this->flash('The ".$singularHumanName." saved.', array('action'=>'index'));\n";
|
||||||
}
|
|
||||||
$actions .= "\t\t\t\texit();\n";
|
$actions .= "\t\t\t\texit();\n";
|
||||||
|
}
|
||||||
$actions .= "\t\t\t} else {\n";
|
$actions .= "\t\t\t} else {\n";
|
||||||
if (low($wannaUseSession) == 'y' || low($wannaUseSession) == 'yes') {
|
if (low($wannaUseSession) == 'y' || low($wannaUseSession) == 'yes') {
|
||||||
$actions .= "\t\t\t\t\$this->Session->setFlash('Please correct errors below.');\n";
|
$actions .= "\t\t\t\t\$this->Session->setFlash('Please correct errors below.');\n";
|
||||||
|
|
|
@ -136,6 +136,15 @@ td.actions a {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Paging */
|
||||||
|
div.paging {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
div.paging div.disabled {
|
||||||
|
color: #ddd;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
/* Scaffold View */
|
/* Scaffold View */
|
||||||
dl {
|
dl {
|
||||||
line-height: 2em;
|
line-height: 2em;
|
||||||
|
|
Loading…
Reference in a new issue