diff --git a/cake/libs/view/templates/scaffolds/add.thtml b/cake/libs/view/templates/scaffolds/add.thtml index 97fb519b5..a0e29bc85 100644 --- a/cake/libs/view/templates/scaffolds/add.thtml +++ b/cake/libs/view/templates/scaffolds/add.thtml @@ -26,12 +26,12 @@ ?> <h2>New <?php echo $humanSingularName?></h2> <?php -echo $form->create($modelClass, array('action' => 'create')); -echo $form->displayFields($fieldNames); -echo $form->generateSubmitDiv('Add'); ?> +echo $form->create($modelClass); +echo $form->inputs($fieldNames); +echo $form->submit('Add'); ?> </form> <ul class='actions'> -<?php echo "<li>".$html->link('List '.$humanPluralName, $path . $viewPath.'/index/')."</li>"; ?> +<?php echo "<li>".$html->link('List '.$humanPluralName, array('action' => 'index'))."</li>"; ?> <?php foreach($fieldNames as $field => $value) { if(isset($value['foreignKey'])) { diff --git a/cake/libs/view/templates/scaffolds/edit.thtml b/cake/libs/view/templates/scaffolds/edit.thtml index 0ac94eea1..f49995899 100644 --- a/cake/libs/view/templates/scaffolds/edit.thtml +++ b/cake/libs/view/templates/scaffolds/edit.thtml @@ -27,25 +27,21 @@ $modelObj =& ClassRegistry::getObject($modelKey); ?> <h2><?php echo $formName.' '.$humanSingularName;?></h2> <?php -if($formName == 'Edit') { - echo $form->create($modelClass, array('action' => 'update')); -} else { - echo $form->create($modelClass, array('action' => 'create')); -} -echo $form->displayFields($fieldNames); -echo $form->generateSubmitDiv('Save'); ?> +echo $form->create($modelClass); +echo $form->inputs($fieldNames); +echo $form->submit('Save'); ?> </form> <ul class='actions'> <?php if($formName == 'Edit') { - echo "<li>".$html->link('Delete '.$humanSingularName, $path . $viewPath.'/delete/'.$data[$modelClass][$primaryKey], null, 'Are you sure you want to delete '.$data[$modelClass][$displayField])."</li>"; + echo "<li>".$html->link('Delete '.$humanSingularName, array('action' => 'delete', $data[$modelClass][$primaryKey]), null, 'Are you sure you want to delete '.$data[$modelClass][$displayField])."</li>"; } -echo "<li>".$html->link('List '.$humanPluralName, $path . $viewPath.'/index')."</li>"; +echo "<li>".$html->link('List '.$humanPluralName, array('action' => 'index'))."</li>"; if($formName == 'Edit') { foreach($fieldNames as $field => $value) { if(isset($value['foreignKey'])) { - echo "<li>".$html->link( "View ".Inflector::humanize($value['controller']), $path . Inflector::underscore($value['controller'])."/index")."</li>"; - echo "<li>".$html->link( "Add ".Inflector::humanize($value['modelKey']), $path . Inflector::underscore($value['controller'])."/add/")."</li>"; + echo '<li>' . $html->link('View ' . Inflector::humanize($value['controller']), array('action' => 'index')) . '</li>'; + echo '<li>' . $html->link('Add ' . Inflector::humanize($value['modelKey']), array('action' => 'add')) . '</li>'; } } }?> diff --git a/cake/libs/view/templates/scaffolds/index.thtml b/cake/libs/view/templates/scaffolds/index.thtml index 6ea69f964..905cb1564 100644 --- a/cake/libs/view/templates/scaffolds/index.thtml +++ b/cake/libs/view/templates/scaffolds/index.thtml @@ -74,7 +74,7 @@ if(is_array($data)) { <?php $id = $row[$modelClass][$modelObj->primaryKey]; ?> <?php echo $html->link('View', array('action' => 'view', $id)) ?> <?php echo $html->link('Edit', array('action' => 'edit', $id)) ?> - <?php echo $html->link('Delete', array('action' => 'view', $id), null, 'Are you sure you want to delete id '.$id.' ?') ?> + <?php echo $html->link('Delete', array('action' => 'delete', $id), null, 'Are you sure you want to delete id '.$id.' ?') ?> </td> </tr> <?php diff --git a/cake/libs/view/templates/scaffolds/view.thtml b/cake/libs/view/templates/scaffolds/view.thtml index 0475e3744..20de3f611 100644 --- a/cake/libs/view/templates/scaffolds/view.thtml +++ b/cake/libs/view/templates/scaffolds/view.thtml @@ -58,14 +58,14 @@ foreach($fieldNames as $field => $value) { </dl> <ul class='actions'> <?php -echo "<li>".$html->link('Edit '.$humanSingularName, $path . $viewPath.'/edit/'.$data[$modelClass][$modelObj->primaryKey])."</li>"; -echo "<li>".$html->link('Delete '.$humanSingularName, $path . $viewPath.'/delete/'.$data[$modelClass][$modelObj->primaryKey], null, 'Are you sure you want to delete id '.$data[$modelClass][$modelObj->primaryKey].' ?')."</li>"; -echo "<li>".$html->link('List '.$humanPluralName, $path . $viewPath.'/index')."</li>"; -echo "<li>".$html->link('New '.$humanSingularName, $path . $viewPath.'/add')."</li>"; +echo '<li>' . $html->link('Edit '.$humanSingularName, array('action' => 'edit', $data[$modelClass][$modelObj->primaryKey])) . '</li>'; +echo '<li>' . $html->link('Delete '.$humanSingularName, array('action' => 'delete', $data[$modelClass][$modelObj->primaryKey]), null, 'Are you sure you want to delete id '.$data[$modelClass][$modelObj->primaryKey].' ?') . '</li>'; +echo '<li>' . $html->link('List '.$humanPluralName, array('action' => 'index')) . '</li>'; +echo '<li>' . $html->link('New '.$humanSingularName, array('action' => 'add')) . '</li>'; -foreach( $fieldNames as $field => $value ) { - if( isset( $value['foreignKey'] ) ) { - echo "<li>".$html->link( "List ".Inflector::humanize($value['controller']), $path . $value['controller'] ."/index/")."</li>"; +foreach($fieldNames as $field => $value) { + if(isset($value['foreignKey'])) { + echo "<li>".$html->link( "List ".Inflector::humanize($value['controller']), array('controller' => $value['controller'], action => 'index')) . '</li>'; echo "<li>".$html->link( "Add ".Inflector::humanize($value['controller']), $path . $value['controller'] ."/add/")."</li>"; } }?> @@ -157,6 +157,6 @@ foreach($relations as $associationName => $relation) { }?> </table> <ul class="actions"> -<?php echo "<li>".$html->link('New '.Inflector::humanize($associationName), $path . $otherControllerPath ."/add/")."</li>";?> + <?php echo "<li>".$html->link('New '.Inflector::humanize($associationName), $path . $otherControllerPath . '/add') . '</li>'; ?> </ul></div> <?php }?> \ No newline at end of file