Skip to content
Permalink
Browse files

Starting to transform the default baked view page

  • Loading branch information...
lorenzo committed Sep 13, 2014
1 parent 21c9c7a commit 4ab55e225dc54d4e0472b9d70d03290e35a5902d
Showing with 26 additions and 26 deletions.
  1. +26 −26 src/Template/Bake/default/views/view.ctp
@@ -14,33 +14,9 @@
*/
use Cake\Utility\Inflector;
?>
<div class="<?= $pluralVar ?> view">
<h2><?= "<?= __('{$singularHumanName}') ?>"; ?></h2>
<dl>
<?php
foreach ($fields as $field) {
$isKey = false;
if (!empty($associations['BelongsTo'])) {
foreach ($associations['BelongsTo'] as $alias => $details) {
if ($field === $details['foreignKey']) {
$isKey = true;
echo "\t\t<dt><?= __('" . Inflector::humanize(Inflector::underscore($details['property'])) . "') ?></dt>\n";
echo "\t\t<dd>\n\t\t\t<?= \${$singularVar}->has('{$details['property']}') ? \$this->Html->link(\${$singularVar}->{$details['property']}->{$details['displayField']}, ['controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}->{$details['property']}->{$details['primaryKey'][0]}]) : '' ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
break;
}
}
}
if ($isKey !== true) {
echo "\t\t<dt><?= __('" . Inflector::humanize($field) . "') ?></dt>\n";
echo "\t\t<dd>\n\t\t\t<?= h(\${$singularVar}->{$field}) ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
}
}
?>
</dl>
</div>
<div class="actions">
<div class="actions columns large-2 medium-3">
<h3><?= "<?= __('Actions'); ?>"; ?></h3>
<ul>
<ul class="side-nav">
<?php
$pk = "\${$singularVar}->{$primaryKey[0]}";
@@ -62,6 +38,30 @@ foreach ($fields as $field) {
?>
</ul>
</div>
<div class="<?= $pluralVar ?> view large-10 medium-9 columns">
<h2><?= "<?= h(\${$singularVar}->{$displayField}) ?>"; ?></h2>
<dl>
<?php
foreach ($fields as $field) {
$isKey = false;
if (!empty($associations['BelongsTo'])) {
foreach ($associations['BelongsTo'] as $alias => $details) {
if ($field === $details['foreignKey']) {
$isKey = true;
echo "\t\t<dt><?= __('" . Inflector::humanize(Inflector::underscore($details['property'])) . "') ?></dt>\n";
echo "\t\t<dd>\n\t\t\t<?= \${$singularVar}->has('{$details['property']}') ? \$this->Html->link(\${$singularVar}->{$details['property']}->{$details['displayField']}, ['controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}->{$details['property']}->{$details['primaryKey'][0]}]) : '' ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
break;
}
}
}
if ($isKey !== true) {
echo "\t\t<dt><?= __('" . Inflector::humanize($field) . "') ?></dt>\n";
echo "\t\t<dd>\n\t\t\t<?= h(\${$singularVar}->{$field}) ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
}
}
?>
</dl>
</div>
<?php
if (!empty($associations['HasOne'])) :
foreach ($associations['HasOne'] as $alias => $details): ?>

0 comments on commit 4ab55e2

Please sign in to comment.
You can’t perform that action at this time.