Skip to content

Commit

Permalink
Starting to transform the default baked view page
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Sep 13, 2014
1 parent 21c9c7a commit 4ab55e2
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/Template/Bake/default/views/view.ctp
Expand Up @@ -14,33 +14,9 @@
*/ */
use Cake\Utility\Inflector; use Cake\Utility\Inflector;
?> ?>
<div class="<?= $pluralVar ?> view"> <div class="actions columns large-2 medium-3">
<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">
<h3><?= "<?= __('Actions'); ?>"; ?></h3> <h3><?= "<?= __('Actions'); ?>"; ?></h3>
<ul> <ul class="side-nav">
<?php <?php
$pk = "\${$singularVar}->{$primaryKey[0]}"; $pk = "\${$singularVar}->{$primaryKey[0]}";


Expand All @@ -62,6 +38,30 @@ foreach ($fields as $field) {
?> ?>
</ul> </ul>
</div> </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 <?php
if (!empty($associations['HasOne'])) : if (!empty($associations['HasOne'])) :
foreach ($associations['HasOne'] as $alias => $details): ?> foreach ($associations['HasOne'] as $alias => $details): ?>
Expand Down

0 comments on commit 4ab55e2

Please sign in to comment.