Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Commit 2d278e5

Browse files
author
David Yell
committed
Added column types to header cells
1 parent f1272e8 commit 2d278e5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Template/Bake/Template/index.ctp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ $fields = collection($fields)
1616
<div class="filter">
1717
<?php
1818
echo $this->Form->create(null, ['class' => 'form-inline']);
19+
echo $this->Form->input('title');
1920
echo $this->Form->button('Filter',['type' => 'submit', 'class' => 'btn btn-success']);
2021
echo $this->Html->link('Reset', ['action' => 'index'], ['class' => 'btn btn-default']);
2122
echo $this->Form->end();
@@ -26,8 +27,17 @@ $fields = collection($fields)
2627
<table cellpadding="0" cellspacing="0" class="table table-hover table-striped">
2728
<thead>
2829
<tr>
29-
<% foreach ($fields as $field): %>
30-
<th><?= $this->Paginator->sort('<%= $field %>') ?></th>
30+
<% foreach ($fields as $field):
31+
$class = '';
32+
if (in_array($schema->columnType($field), ['integer', 'biginteger', 'decimal', 'float'])) {
33+
$class = ' class="number"';
34+
} elseif (in_array($schema->columnType($field), ['date', 'datetime', 'timestamp', 'time'])) {
35+
$class = ' class="time"';
36+
} elseif (in_array($schema->columnType($field), ['boolean'])) {
37+
$class = ' class="boolean"';
38+
}
39+
%>
40+
<th<%= $class %>><?= $this->Paginator->sort('<%= $field %>') ?></th>
3141
<% endforeach; %>
3242
<th class="actions"><?= __('Actions') ?></th>
3343
</tr>

0 commit comments

Comments
 (0)