Skip to content

Commit c90972f

Browse files
committed
merge
2 parents 75804a1 + 149bad2 commit c90972f

25 files changed

+355
-109
lines changed

build.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function runDir(string $base, string $dir, array &$lines, array $ignore): int
5454
}
5555
array_push($lines, 'END_OF_HTML;', '}', '');
5656
$count++;
57-
} elseif (in_array($extension, ['css', 'svg', 'js'])) {
57+
} elseif (in_array($extension, ['css', 'svg', 'js', 'woff', 'woff2', 'ico'])) {
5858
$data = base64_encode(file_get_contents($filename));
5959
$id = substr("$dir/$entry", 7);
6060
array_push($lines, "// file: $dir/$entry");

composer.lock

+5-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
$composer = file_get_contents('https://getcomposer.org/composer.phar');
77
file_put_contents('composer.phar', $composer);
88
}
9-
exec('php composer.phar install');
9+
exec('php composer.phar install --ignore-platform-reqs');
1010

1111
include 'patch.php';

src/Tqdev/PhpCrudUi/Controller/MultiResponder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ public function success($result): ResponseInterface
6060

6161
public function multi($results): ResponseInterface
6262
{
63-
return success($results);
63+
return $this->success($results);
6464
}
6565

6666
public function exception($exception): ResponseInterface
6767
{
68-
68+
return $this->error(ErrorCode::ERROR_NOT_FOUND, $exception->getMessage());
6969
}
7070

7171
}

src/Tqdev/PhpCrudUi/Controller/RecordController.php

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class RecordController
1818
public function __construct(Router $router, Responder $responder, RecordService $service)
1919
{
2020
$router->register('GET', '/', array($this, 'home'));
21+
$router->register('GET', '/menu', array($this, 'menu'));
2122
$router->register('GET', '/*/create', array($this, 'createForm'));
2223
$router->register('POST', '/*/create', array($this, 'create'));
2324
$router->register('GET', '/*/read/*', array($this, 'read'));
@@ -39,6 +40,12 @@ public function home(ServerRequestInterface $request): ResponseInterface
3940
return $this->responder->success($result);
4041
}
4142

43+
public function menu(ServerRequestInterface $request): ResponseInterface
44+
{
45+
$result = $this->service->menu();
46+
return $this->responder->success($result);
47+
}
48+
4249
public function createForm(ServerRequestInterface $request): ResponseInterface
4350
{
4451
$table = RequestUtils::getPathSegment($request, 1);

src/Tqdev/PhpCrudUi/Middleware/StaticFileMiddleware.php

+6
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@ private function getContentType(string $filename): string
1717
switch ($extension) {
1818
case 'css':
1919
return 'text/css';
20+
case 'woff':
21+
return 'font/woff';
22+
case 'woff2':
23+
return 'font/woff2';
2024
case 'svg':
2125
return 'image/svg+xml';
26+
case 'ico':
27+
return 'image/x-icon';
2228
case 'js':
2329
return 'application/javascript';
2430
}

src/Tqdev/PhpCrudUi/Record/RecordService.php

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ public function home(): TemplateDocument
4848
return new TemplateDocument('layouts/default', 'record/home', array());
4949
}
5050

51+
public function menu(): TemplateDocument
52+
{
53+
return new TemplateDocument('layouts/menu', 'record/menu', array());
54+
}
55+
5156
public function createForm(string $table, string $action): TemplateDocument
5257
{
5358
$types = $this->definition->getTypes($table, $action);

templates/layouts/default.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
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">-->
9+
<link rel="shortcut icon" href="{{base}}/img/favicon.ico">
910
</head>
1011

11-
<body>
12+
<body class="{{table}}">
1213
<div class="content">
1314
<div class="navigation">
1415
<a href="{{base}}/" class="title"><span>{{info.title}}</span>{{info.x-subtitle}}</a>
15-
<a class="hamburger" href="{{base}}/"></a>
16+
<a class="hamburger" href="{{base}}/menu" title="Open menu"><span></span><span></span><span></span></a>
1617
</div>
1718
<div class="body">
1819
{{content}}

templates/layouts/error.html

+12-17
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,21 @@
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">
7-
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
8-
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap-theme.min.css"
9-
rel="stylesheet">
7+
<link rel="stylesheet" type="text/css" href="{{base}}/css/style.css">
8+
<!--<link rel="stylesheet" type="text/css" href="{{base}}/css/music.css">-->
9+
<link rel="shortcut icon" href="{{base}}/img/favicon.ico">
1010
</head>
1111

12-
<body>
13-
<div class="container-fluid">
14-
<nav class="navbar navbar-default">
15-
<div class="container-fluid">
16-
<div class="navbar-header">
17-
<a class="navbar-brand" href="{{base}}/">PHP-CRUD-UI</a>
18-
</div>
19-
</div>
20-
</nav>
21-
<div class="row">
22-
<div class="col-md-12">
23-
{{content}}
24-
</div>
12+
<body class="{{table}}">
13+
<div class="content">
14+
<div class="navigation">
15+
<a href="{{base}}/" class="title"><span>{{info.title}}</span>{{info.x-subtitle}}</a>
16+
<a class="hamburger" href="{{base}}/menu" title="Open menu"><span></span><span></span><span></span></a>
17+
</div>
18+
<div class="body">
19+
{{content}}
2520
</div>
2621
</div>
2722
</body>

templates/layouts/menu.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>{{info.title}}</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<link rel="stylesheet" type="text/css" href="{{base}}/css/style.css">
8+
<!--<link rel="stylesheet" type="text/css" href="{{base}}/css/music.css">-->
9+
<link rel="shortcut icon" href="{{base}}/img/favicon.ico">
10+
</head>
11+
12+
<body class="{{table}}">
13+
<div class="content">
14+
<div class="navigation">
15+
<a href="{{base}}/" class="title"><span>{{info.title}}</span>{{info.x-subtitle}}</a>
16+
<a class="hamburger close" href="javascript:window.history.go(-1);"
17+
title="Close menu"><span></span><span></span><span></span></a>
18+
</div>
19+
<div class="body">
20+
{{content}}
21+
</div>
22+
</div>
23+
</body>
24+
25+
</html>

templates/record/list.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ <h1>{{table|humanize}}</h1>
5858
{{endfor}}
5959

6060
<div class="addFilter">
61-
<form style="display:inline" method="post">
61+
<form style="display:inline" method="post" action="#">
6262
<select name="field" onchange="updateAddFilter();">
6363
{{for:column:columns}}
6464
{{if:column|neq(primaryKey)}}
@@ -83,7 +83,7 @@ <h1>{{table|humanize}}</h1>
8383
</div>
8484

8585
<div class="addSearch">
86-
<form style="display:inline" method="post">
86+
<form style="display:inline" method="post" action="#">
8787
<input type="text" name="search" />
8888
<input type="submit" value="Search" />
8989
</form>

templates/record/menu.html

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<br />
2+
<ul class="home">
3+
{{for:item:menu}}
4+
<li>
5+
<a href="{{base}}/{{item}}/list">{{item|humanize}}</a>
6+
</li>
7+
{{endfor}}
8+
</ul>

0 commit comments

Comments
 (0)