Compare commits
7 Commits
85a158c435
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a16a554457 | |||
| 2b47495d60 | |||
| ad53457ca2 | |||
| 3213c0f84f | |||
| 735c111e12 | |||
| fdf0f55b8d | |||
| ec798515d1 |
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
"potter/controller": ">=0.0.1",
|
"potter/controller": ">=0.0.1",
|
||||||
"potter/response": ">=0.0.1",
|
"potter/response": ">=0.0.1",
|
||||||
"potter/router": ">=0.0.1",
|
"potter/router": ">=0.0.1",
|
||||||
"psr/http-message": "^2.0.0",
|
"psr/http-message": "^1.1.0",
|
||||||
"twbs/bootstrap": "^5.3.8"
|
"twbs/bootstrap": "^5.3.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,28 +4,28 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Potter;
|
namespace Potter;
|
||||||
|
|
||||||
use \Potter\Response\Text,
|
use \Potter\Response\Text;
|
||||||
\Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
|
use \Psr\Http\Message\{ResponseInterface, ServerRequestInterface};
|
||||||
|
|
||||||
final class Bootstrap extends Controller
|
final class Bootstrap extends Controller
|
||||||
{
|
{
|
||||||
static private function getBootstrapScript(ServerRequestInterface $request): ResponseInterface
|
public function getBootstrapScript(ServerRequestInterface $request): ResponseInterface
|
||||||
{
|
{
|
||||||
return new Text(
|
return new Text(
|
||||||
text: file_get_contents(getcwd() . '/vendor/twbs/bootstrap/dist/jss/bootstrap.js'),
|
text: file_get_contents(getcwd() . '/vendor/twbs/bootstrap/dist/js/bootstrap.js'),
|
||||||
headers: ['Content-Type' => ['application/javascript; charset=utf-8']]);
|
headers: ['Content-Type' => ['application/javascript; charset=utf-8']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static private function getBootstrapStyle(ServerRequestInterface $request): ResponseInterface
|
public function getBootstrapStyle(ServerRequestInterface $request): ResponseInterface
|
||||||
{
|
{
|
||||||
return new Text(
|
return new Text(
|
||||||
text: file_get_contents(getcwd() . '/vendor/twbs/bootstrap/dist/jss/bootstrap.js'),
|
text: file_get_contents(getcwd() . '/vendor/twbs/bootstrap/dist/css/bootstrap.css'),
|
||||||
headers: ['Content-Type' => ['text/css; charset=utf-8']]);
|
headers: ['Content-Type' => ['text/css; charset=utf-8']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static private function mapRoutes(Container $container, \Potter\Router\Router $router): void
|
protected function mapRoutes(Container $container, \Potter\Router\Router $router): void
|
||||||
{
|
{
|
||||||
$router->map('GET', '/bootstrap.js', [self::class, 'getBootstrapScript']);
|
$router->map('GET', '/bootstrap.js', [$this, 'getBootstrapScript']);
|
||||||
$router->map('GET', '/bootstrap.css', [self::class, 'getBootstrapStyle']);
|
$router->map('GET', '/bootstrap.css', [$this, 'getBootstrapStyle']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user