Removing 'altclass' from scaffold templates.

Refs #306
This commit is contained in:
Mark Story 2011-06-22 13:08:17 -07:00
parent 1a155c80c0
commit edda41e23b
3 changed files with 14 additions and 33 deletions

View file

@ -128,7 +128,6 @@ div.actions h3 {
/** Tables **/
table {
background: #fff;
border-right:0;
clear: both;
color: #333;
@ -153,16 +152,12 @@ th a.desc:after {
content: ' ⇡';
}
table tr td {
background: #fff;
padding: 6px;
text-align: left;
vertical-align: top;
border-bottom:1px solid #ddd;
}
table tr:nth-child(2n) td {
background: #f5f5f5;
}
table .altrow td {
table tr:nth-child(even) {
background: #f5f5f5;
}
td.actions {
@ -208,9 +203,11 @@ dl {
margin: 0em 0em;
width: 60%;
}
dl .altrow {
dl dd:nth-child(4n+2),
dl dt:nth-child(4n+1) {
background: #f4f4f4;
}
dt {
font-weight: bold;
padding-left: 4px;

View file

@ -28,11 +28,7 @@
<?php
$i = 0;
foreach (${$pluralVar} as ${$singularVar}):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
echo "<tr{$class}>";
echo "<tr>";
foreach ($scaffoldFields as $_field) {
$isKey = false;
if (!empty($associations['belongsTo'])) {
@ -93,4 +89,4 @@ endforeach;
}
?>
</ul>
</div>
</div>

View file

@ -22,24 +22,20 @@
<?php
$i = 0;
foreach ($scaffoldFields as $_field) {
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
$isKey = false;
if (!empty($associations['belongsTo'])) {
foreach ($associations['belongsTo'] as $_alias => $_details) {
if ($_field === $_details['foreignKey']) {
$isKey = true;
echo "\t\t<dt{$class}>" . Inflector::humanize($_alias) . "</dt>\n";
echo "\t\t<dd{$class}>\n\t\t\t" . $this->Html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "\n\t\t&nbsp;</dd>\n";
echo "\t\t<dt>" . Inflector::humanize($_alias) . "</dt>\n";
echo "\t\t<dd>\n\t\t\t" . $this->Html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "\n\t\t&nbsp;</dd>\n";
break;
}
}
}
if ($isKey !== true) {
echo "\t\t<dt{$class}>" . Inflector::humanize($_field) . "</dt>\n";
echo "\t\t<dd{$class}>" . h(${$singularVar}[$modelClass][$_field]) . "&nbsp;</dd>\n";
echo "\t\t<dt>" . Inflector::humanize($_field) . "</dt>\n";
echo "\t\t<dd>" . h(${$singularVar}[$modelClass][$_field]) . "&nbsp;</dd>\n";
}
}
?>
@ -78,12 +74,8 @@ foreach ($associations['hasOne'] as $_alias => $_details): ?>
$i = 0;
$otherFields = array_keys(${$singularVar}[$_alias]);
foreach ($otherFields as $_field) {
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
echo "\t\t<dt{$class}>" . Inflector::humanize($_field) . "</dt>\n";
echo "\t\t<dd{$class}>\n\t" . ${$singularVar}[$_alias][$_field] . "\n&nbsp;</dd>\n";
echo "\t\t<dt>" . Inflector::humanize($_field) . "</dt>\n";
echo "\t\t<dd>\n\t" . ${$singularVar}[$_alias][$_field] . "\n&nbsp;</dd>\n";
}
?>
</dl>
@ -129,11 +121,7 @@ $otherSingularVar = Inflector::variable($_alias);
<?php
$i = 0;
foreach (${$singularVar}[$_alias] as ${$otherSingularVar}):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
echo "\t\t<tr{$class}>\n";
echo "\t\t<tr>\n";
foreach ($otherFields as $_field) {
echo "\t\t\t<td>" . ${$otherSingularVar}[$_field] . "</td>\n";
@ -155,4 +143,4 @@ $otherSingularVar = Inflector::variable($_alias);
</ul>
</div>
</div>
<?php endforeach;?>
<?php endforeach;?>