Navigation Menu

Skip to content

Commit

Permalink
Adjust markup table header + new configurable tableHeaderClass
Browse files Browse the repository at this point in the history
  • Loading branch information
rchavik committed Jul 4, 2019
1 parent 158ecc2 commit 927616d
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 71 deletions.
2 changes: 1 addition & 1 deletion Blocks/src/Template/Admin/Blocks/index.ctp
Expand Up @@ -24,7 +24,7 @@ $tableHeaders = $this->Html->tableHeaders([
$this->Paginator->sort('status', __d('croogo', 'Status')),
__d('croogo', 'Actions'),
]);
echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->append('table-body');
Expand Down
2 changes: 1 addition & 1 deletion Contacts/src/Template/Admin/Messages/index.ctp
Expand Up @@ -55,7 +55,7 @@ $tableHeaders = $this->Html->tableHeaders([
$this->Paginator->sort('created', __d('croogo', 'Created')),
__d('croogo', 'Actions'),
]);
echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->append('table-body');
Expand Down
5 changes: 4 additions & 1 deletion Core/src/Template/Common/admin_index.ctp
Expand Up @@ -12,6 +12,7 @@ $i18nDomain = $this->request->param('plugin') ? 'croogo' : $this->request->param

$rowClass = $this->Theme->getCssClass('row');
$columnFull = $this->Theme->getCssClass('columnFull');
$tableHeaderClass = isset($tableHeaderClass) ? $tableHeaderClass : $this->Theme->getCssClass('tableHeaderClass');
$tableClass = isset($tableClass) ? $tableClass : $this->Theme->getCssClass('tableClass');
$tableContainerClass = $this->Theme->getCssClass('tableContainerClass');

Expand Down Expand Up @@ -133,7 +134,9 @@ $tableFooters = trim($this->fetch('table-footer'));
<div class="<?= $tableContainerClass ?>">
<table class="<?= $tableClass ?>">
<?php
echo $this->Html->tag('thead', $tableHeaders);
echo $this->Html->tag('thead', $tableHeaders, [
'class' => $tableHeaderClass,
]);
echo $this->Html->tag('tbody', $tableBody);
if ($tableFooters):
echo $this->Html->tag('tfoot', $tableFooters);
Expand Down
2 changes: 1 addition & 1 deletion Dashboards/src/Template/Admin/Dashboards/index.ctp
Expand Up @@ -19,7 +19,7 @@ $this->append('table-heading');
$this->Paginator->sort('created'),
__d('croogo', 'Actions'),
));
echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->append('table-body');
Expand Down
1 change: 1 addition & 0 deletions Extensions/src/CroogoTheme.php
Expand Up @@ -79,6 +79,7 @@ public function getData($theme = null, $path = null)
'formInput' => 'input-block-level',
'imageClass' => 'img-fluid',
'row' => 'row',
'tableHeaderClass' => 'thead-light',
'tableClass' => 'table table-striped',
'tableContainerClass' => 'table-responsive',
'thumbnailClass' => 'img-thumbnail',
Expand Down
2 changes: 1 addition & 1 deletion Extensions/src/Template/Admin/Locales/index.ctp
Expand Up @@ -24,7 +24,7 @@ $this->start('table-heading');
__d('croogo', 'Default'),
__d('croogo', 'Actions'),
));
echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->append('table-body');
Expand Down
17 changes: 7 additions & 10 deletions Extensions/src/Template/Admin/Plugins/index.ctp
Expand Up @@ -9,10 +9,9 @@ $this->Breadcrumbs->add(__d('croogo', 'Extensions'), $this->request->getUri()->g

$this->start('action-buttons');
echo $this->Croogo->adminAction(__d('croogo', 'Upload'), ['action' => 'add']);
$this->end() ?>
$this->end();

<table class="table table-striped">
<?php
$this->append('table-heading');
$tableHeaders = $this->Html->tableHeaders([
'',
__d('croogo', 'Alias'),
Expand All @@ -21,12 +20,11 @@ $this->end() ?>
__d('croogo', 'Active'),
__d('croogo', 'Actions'),
]);
?>
<thead>
<?= $tableHeaders ?>
</thead>
echo $tableHeaders;
$this->end();

$this->append('table-body');

<?php
$rows = [];
foreach ($plugins as $pluginAlias => $pluginData):
$toggleText = $pluginData['active'] ? __d('croogo', 'Deactivate') : __d('croogo', 'Activate');
Expand Down Expand Up @@ -78,5 +76,4 @@ $this->end() ?>
endforeach;

echo $this->Html->tableCells($rows);
?>
</table>
$this->end();
2 changes: 1 addition & 1 deletion FileManager/src/Template/Admin/Attachments/index.ctp
Expand Up @@ -47,7 +47,7 @@ $this->append('table-heading');
__d('croogo', 'Actions'),
));

echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->append('search', $this->element('Croogo/Core.admin/search'));
Expand Down
5 changes: 3 additions & 2 deletions FileManager/src/Template/Admin/FileManager/browse.ctp
@@ -1,6 +1,7 @@
<?php

$this->extend('Croogo/Core./Common/admin_index');
$tableHeaderClass = $this->Theme->getCssClass('tableHeaderClass');

$this->assign('title', __d('croogo', 'File Manager'));
$this->Breadcrumbs->add(__d('croogo', 'File Manager'), $this->request->getRequestTarget());
Expand Down Expand Up @@ -31,7 +32,7 @@ $this->Breadcrumbs->add(__d('croogo', 'File Manager'), $this->request->getReques
__d('croogo', 'Actions'),
]);
?>
<thead>
<thead class="<?= $tableHeaderClass ?>">
<?= $tableHeaders ?>
</thead>
<?php
Expand Down Expand Up @@ -104,7 +105,7 @@ $this->Breadcrumbs->add(__d('croogo', 'File Manager'), $this->request->getReques
echo $this->Html->tableCells($rows, ['class' => 'file-listing'], ['class' => 'file-listing']);

?>
<thead>
<thead class="<?= $tableHeaderClass ?>">
<?= $tableHeaders ?>
</thead>
</table>
Expand Down
4 changes: 3 additions & 1 deletion FileManager/src/Template/Element/admin/asset_list.ctp
Expand Up @@ -5,6 +5,8 @@ use Cake\Utility\Inflector;
use Cake\ORM\TableRegistry;
use Cake\view\Form\NullContext;

$tableHeaderClass = $this->Theme->getCssClass('tableHeaderClass');

$this->Html->script([
'Croogo/FileManager.admin.js',
'Croogo/FileManager.assets.js',
Expand Down Expand Up @@ -252,7 +254,7 @@ $this->set('_assetButtons', true);
endif;
?>
<table class="<?php echo $this->Theme->getCssClass('tableClass'); ?> asset-list" data-url="<?php echo $assetListUrl; ?>">
<thead><?php echo $this->Html->tableHeaders($headers); ?></thead>
<thead class="<?= $tableHeaderClass ?>"><?php echo $this->Html->tableHeaders($headers); ?></thead>
<tbody><?php echo $this->Html->tableCells($rows); ?></tbody>
</table>
<?php
Expand Down
2 changes: 1 addition & 1 deletion Menus/src/Template/Admin/Links/index.ctp
Expand Up @@ -29,7 +29,7 @@ $tableHeaders = $this->Html->tableHeaders([
__d('croogo', 'Status'),
__d('croogo', 'Actions'),
]);
echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->append('table-body');
Expand Down
2 changes: 1 addition & 1 deletion Menus/src/Template/Admin/Menus/index.ctp
Expand Up @@ -14,7 +14,7 @@ $tableHeaders = $this->Html->tableHeaders([
$this->Paginator->sort('status', __d('croogo', 'Status')),
__d('croogo', 'Actions'),
]);
echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->start('table-body');
Expand Down
96 changes: 50 additions & 46 deletions Nodes/src/Template/Admin/Nodes/translations.ctp
@@ -1,51 +1,55 @@
<div class="nodes index">
<h2><?= $title_for_layout ?></h2>
<?php

<div class="actions">
<ul>
<li>
<?php
echo $this->Html->link(__d('croogo', 'Translate in a new language'), array(
'controller' => 'languages',
'action' => 'select',
'nodes',
'translate',
$node['Node']['id'],
));
?>
</li>
</ul>
</div>
$this->append('action-buttons');
echo $this->Html->link(__d('croogo', 'Translate in a new language'), [
'controller' => 'languages',
'action' => 'select',
'nodes',
'translate',
$node['Node']['id'],
]);
$this->end();

<?php if (count($translations) > 0): ?>
<table cellpadding="0" cellspacing="0">
<?php
$tableHeaders = $this->Html->tableHeaders(array(
'',
__d('croogo', 'Title'),
__d('croogo', 'Locale'),
__d('croogo', 'Actions'),
));
echo $tableHeaders;
if (count($translations) == 0):
echo __d('croogo', 'No translations available.');
return;
endif;

$this->append('table-heading');
$tableHeaders = $this->Html->tableHeaders(array(
'',
__d('croogo', 'Title'),
__d('croogo', 'Locale'),
__d('croogo', 'Actions'),
));
echo $tableHeaders;
$this->end();

$rows = array();
foreach ($translations as $translation) {
$actions = $this->Html->link(__d('croogo', 'Edit'), array('action' => 'translate', $id, 'locale' => $translation[$runtimeModelAlias]['locale']));
$actions .= ' ' . $this->Form->postLink(__d('croogo', 'Delete'), array('action' => 'delete_translation', $translation[$runtimeModelAlias]['locale'], $id), null, __d('croogo', 'Are you sure?'));
$this->append('table-footer');
echo $tableHeaders;
$this->end();

$rows[] = array(
'',
$translation[$runtimeModelAlias]['content'],
$translation[$runtimeModelAlias]['locale'],
$actions,
);
}
$this->append('table-body');

$rows = [];
foreach ($translations as $translation):
$actions = $this->Html->link(__d('croogo', 'Edit'), [
'action' => 'translate',
$id,
'locale' => $translation[$runtimeModelAlias]['locale'],
]);
$actions .= ' ' . $this->Form->postLink(__d('croogo', 'Delete'), [
'action' => 'delete_translation',
$translation[$runtimeModelAlias]['locale'],
$id
], null, __d('croogo', 'Are you sure?'));
$rows[] = array(
'',
$translation[$runtimeModelAlias]['content'],
$translation[$runtimeModelAlias]['locale'],
$actions,
);
endforeach;

echo $this->Html->tableCells($rows);
echo $tableHeaders;
?>
</table>
<?php else: ?>
<p><?= __d('croogo', 'No translations available.') ?></p>
<?php endif ?>
</div>
echo $this->Html->tableCells($rows);
$this->end();
2 changes: 1 addition & 1 deletion Settings/src/Template/Admin/Settings/index.ctp
Expand Up @@ -20,7 +20,7 @@ $this->start('table-heading');
$this->Paginator->sort('editable', __d('croogo', 'Editable')),
__d('croogo', 'Actions'),
));
echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->append('table-body');
Expand Down
2 changes: 1 addition & 1 deletion Taxonomy/src/Template/Admin/Terms/index.ctp
Expand Up @@ -25,7 +25,7 @@ $tableHeaders = $this->Html->tableHeaders([
__d('croogo', 'Slug'),
__d('croogo', 'Actions'),
]);
echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->append('table-body');
Expand Down
2 changes: 1 addition & 1 deletion Taxonomy/src/Template/Admin/Vocabularies/index.ctp
Expand Up @@ -14,7 +14,7 @@ $tableHeaders = $this->Html->tableHeaders([
__d('croogo', 'Actions'),
]);

echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->append('table-body');
Expand Down
2 changes: 1 addition & 1 deletion Translate/src/Template/Admin/Translate/index.ctp
Expand Up @@ -92,7 +92,7 @@ $this->append('table-heading');
__d('croogo', 'Locale'),
__d('croogo', 'Actions'),
));
echo $this->Html->tag('thead', $tableHeaders);
echo $tableHeaders;
$this->end();

$this->append('table-body');
Expand Down

0 comments on commit 927616d

Please sign in to comment.