chg: [home] Added link to index for each panels

pull/72/head
mokaddem 2021-09-07 09:59:36 +02:00
parent 8548332762
commit 3f4e2ae4b8
5 changed files with 57 additions and 47 deletions

View File

@ -13,7 +13,7 @@ $routes->plugin(
['controller' => 'Tags'] ['controller' => 'Tags']
); );
// $routes->get('/', ['controller' => 'Tags']); $routes->get('/', ['controller' => 'Tags', 'action' => 'index']);
// $routes->get('/{id}', ['controller' => 'Tags', 'action' => 'view']); // $routes->get('/{id}', ['controller' => 'Tags', 'action' => 'view']);
// $routes->put('/{id}', ['controller' => 'Tags', 'action' => 'edit']); // $routes->put('/{id}', ['controller' => 'Tags', 'action' => 'edit']);
} }

View File

@ -1,17 +1,25 @@
<?php <?php
// $Parsedown = new Parsedown(); // $Parsedown = new Parsedown();
// echo $Parsedown->text($md); // echo $Parsedown->text($md);
?> ?>
<h2><?= __('Home') ?></h2>
<div class="row"> <div class="row">
<?php foreach ($statistics as $modelName => $statistics): ?> <?php foreach ($statistics as $modelName => $statistics): ?>
<div class="col-sm-6 col-md-4 col-l-3 col-xl-2 mb-2"> <div class="col-sm-6 col-md-4 col-l-3 col-xl-2 mb-2">
<?php <?php
$modelName = explode('.', $modelName); $exploded = explode('.', $modelName);
$modelName = $modelName[count($modelName)-1]; $modelForDisplay = $exploded[count($exploded)-1];
$panelTitle = $this->Html->link(
h($modelForDisplay),
$this->Url->build([
'controller' => $modelForDisplay,
'action' => 'index',
]),
['class' => 'text-white']
);
echo $this->element('widgets/highlight-panel', [ echo $this->element('widgets/highlight-panel', [
'title' => $modelName, 'titleHtml' => $panelTitle,
'number' => $statistics['amount'], 'number' => $statistics['amount'],
'variation' => $statistics['variation'] ?? '', 'variation' => $statistics['variation'] ?? '',
'chartData' => $statistics['timeline'] ?? [] 'chartData' => $statistics['timeline'] ?? []

View File

@ -14,10 +14,8 @@ foreach ($chartData as $i => $entry) {
<div id="<?= $chartId ?>"></div> <div id="<?= $chartId ?>"></div>
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script> <script>
(function() { $(document).ready(function() {
const passedOptions = <?= json_encode($chartOptions) ?>; const passedOptions = <?= json_encode($chartOptions) ?>;
const defaultOptions = { const defaultOptions = {
chart: { chart: {
@ -57,8 +55,7 @@ foreach ($chartData as $i => $entry) {
} }
const chartOptions = Object.assign({}, defaultOptions, passedOptions) const chartOptions = Object.assign({}, defaultOptions, passedOptions)
new ApexCharts(document.querySelector('#<?= $chartId ?>'), chartOptions).render(); new ApexCharts(document.querySelector('#<?= $chartId ?>'), chartOptions).render();
})
})()
</script> </script>
<style> <style>

View File

@ -17,8 +17,9 @@ $variationHtml = sprintf('<div class="%s"><span class="%s mr-2"></span>%s</div>'
!empty($variation) ? h($variation) : '' !empty($variation) ? h($variation) : ''
); );
$titleHtml = isset($title) ? h($title) : ($titleHtml ?? '');
$leftContent = sprintf('<div class="">%s</div><h2 class="my-2">%s</h2>%s', $leftContent = sprintf('<div class="">%s</div><h2 class="my-2">%s</h2>%s',
h($title ?? ''), $titleHtml,
h($number ?? ''), h($number ?? ''),
$variationHtml $variationHtml
); );

View File

@ -1,3 +1,7 @@
:root {
--cerebrate: #924da6;
}
.pagination li.page-item > a.page-link > .ellipsis { .pagination li.page-item > a.page-link > .ellipsis {
line-height: 12px; line-height: 12px;
vertical-align: top; vertical-align: top;