Skip to content

Commit 4c62593

Browse files
committed
Add info
1 parent 1890eae commit 4c62593

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

src/Tqdev/PhpCrudUi/Column/SpecificationService.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,21 @@ public function getColumns(string $table, string $action): array
199199
return array_keys($properties);
200200
}
201201

202+
public function getInfo()
203+
{
204+
$info = array();
205+
if (isset($this->definition['info'])) {
206+
$info = $this->definition['info'];
207+
if (!isset($info['title'])) {
208+
$info['title'] = 'PHP-CRUD-UI';
209+
}
210+
if (!isset($info['x-subtitle'])) {
211+
$info['x-subtitle'] = 'by TQdev.com';
212+
}
213+
}
214+
return $info;
215+
}
216+
202217
public function getMenu()
203218
{
204219
$items = array();

src/Tqdev/PhpCrudUi/Ui.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
use Tqdev\PhpCrudApi\Record\ErrorCode;
1111
use Tqdev\PhpCrudApi\ResponseUtils;
1212
use Tqdev\PhpCrudUi\Client\CrudApi;
13+
use Tqdev\PhpCrudUi\Client\CurlCaller;
14+
use Tqdev\PhpCrudUi\Client\LocalCaller;
1315
use Tqdev\PhpCrudUi\Column\SpecificationService;
14-
use Tqdev\PhpCrudUi\Controller\RecordController;
1516
use Tqdev\PhpCrudUi\Controller\MultiResponder;
16-
use Tqdev\PhpCrudUi\Record\RecordService;
17-
use Tqdev\PhpCrudUi\Client\LocalCaller;
18-
use Tqdev\PhpCrudUi\Client\CurlCaller;
17+
use Tqdev\PhpCrudUi\Controller\RecordController;
1918
use Tqdev\PhpCrudUi\Middleware\StaticFileMiddleware;
19+
use Tqdev\PhpCrudUi\Record\RecordService;
2020

2121
class Ui implements RequestHandlerInterface
2222
{
@@ -43,6 +43,7 @@ public function __construct(Config $config)
4343
break;
4444
}
4545
}
46+
$responder->setVariable('info', $definition->getInfo());
4647
$responder->setVariable('base', $router->getBasePath());
4748
$responder->setVariable('menu', $definition->getMenu());
4849
$responder->setVariable('table', '');

templates/layouts/default.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33

44
<head>
5-
<title>PHP-CRUD-UI</title>
5+
<title>{{info.title}}</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<link rel="stylesheet" type="text/css" href="{{base}}/css/style.css">
88
<!--<link rel="stylesheet" type="text/css" href="{{base}}/css/music.css">-->
@@ -11,7 +11,7 @@
1111
<body>
1212
<div class="content">
1313
<div class="navigation">
14-
<a href="{{base}}/" class="title"><span>Projectnaam</span>Subtitel</a>
14+
<a href="{{base}}/" class="title"><span>{{info.title}}</span>{{info.x-subtitle}}</a>
1515
<a class="hamburger" href="{{base}}/"></a>
1616
</div>
1717
<div class="body">

templates/record/home.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<li><a href="{{base}}/">Home</a></li>
33
</ul>
44

5-
<h1>Projectnaam</h1>
5+
<h1>{{info.title}}</h1>
66
<br />
77
<ul class="home">
88
{{for:item:menu}}
9-
<li>
10-
<a href="{{base}}/{{item}}/list">{{item|humanize}}</a>
11-
</li>
9+
<li>
10+
<a href="{{base}}/{{item}}/list">{{item|humanize}}</a>
11+
</li>
1212
{{endfor}}
13-
</ul>
13+
</ul>

0 commit comments

Comments
 (0)