Maps
-TODO
-diff --git a/public/index.php b/public/index.php index d1677c7..8c3d2bd 100644 --- a/public/index.php +++ b/public/index.php @@ -23,7 +23,6 @@ Container::$routeCollection->group('game', function (MapGuesser\Routing\RouteCol $routeCollection->post('guess-json', '{mapId}/guess.json', [MapGuesser\Controller\GameFlowController::class, 'evaluateGuess']); }); Container::$routeCollection->group('admin', function (MapGuesser\Routing\RouteCollection $routeCollection) { - $routeCollection->get('admin.maps', 'maps', [MapGuesser\Controller\MapAdminController::class, 'getMaps']); $routeCollection->get('admin.mapEditor', 'mapEditor/{mapId}', [MapGuesser\Controller\MapAdminController::class, 'getMapEditor']); $routeCollection->get('admin.place', 'place.json/{placeId}', [MapGuesser\Controller\MapAdminController::class, 'getPlace']); $routeCollection->post('admin.saveMap', 'saveMap/{mapId}/json', [MapGuesser\Controller\MapAdminController::class, 'saveMap']); diff --git a/public/static/css/mapguesser.css b/public/static/css/mapguesser.css index 6be0b44..7bedd39 100644 --- a/public/static/css/mapguesser.css +++ b/public/static/css/mapguesser.css @@ -162,6 +162,14 @@ button.red:hover, button.red:focus, a.button.red:hover, a.button.red:focus { background-color: #7f2929; } +button.yellow, a.button.yellow { + background-color: #e8a349; +} + +button.yellow:hover, button.yellow:focus, a.button.yellow:hover, a.button.yellow:focus { + background-color: #c37713; +} + input, select, textarea { background-color: #f9fafb; border: solid #c8d2e1 1px; diff --git a/public/static/css/maps.css b/public/static/css/maps.css index 69da1db..323d772 100644 --- a/public/static/css/maps.css +++ b/public/static/css/maps.css @@ -27,7 +27,7 @@ div.mapItem>img { } div.mapItem>div.inner { - padding: 8px; + padding: 10px 8px; } div.mapItem>div.inner>div.info { diff --git a/src/Controller/MapAdminController.php b/src/Controller/MapAdminController.php index f4809c8..0019469 100644 --- a/src/Controller/MapAdminController.php +++ b/src/Controller/MapAdminController.php @@ -37,13 +37,6 @@ class MapAdminController implements ISecured return $user !== null && $user->hasPermission(IUser::PERMISSION_ADMIN); } - public function getMaps(): IContent - { - //TODO - - return new HtmlContent('admin/maps'); - } - public function getMapEditor(): IContent { $mapId = (int) $this->request->query('mapId'); diff --git a/src/Controller/MapsController.php b/src/Controller/MapsController.php index 46aa8b3..d56dd59 100644 --- a/src/Controller/MapsController.php +++ b/src/Controller/MapsController.php @@ -2,13 +2,22 @@ use MapGuesser\Database\Query\Select; use MapGuesser\Database\RawExpression; +use MapGuesser\Interfaces\Authentication\IUser; use MapGuesser\Interfaces\Database\IResultSet; +use MapGuesser\Interfaces\Request\IRequest; use MapGuesser\Interfaces\Response\IContent; use MapGuesser\Util\Geo\Bounds; use MapGuesser\Response\HtmlContent; class MapsController { + private IRequest $request; + + public function __construct(IRequest $request) + { + $this->request = $request; + } + public function getMaps(): IContent { $select = new Select(\Container::$dbConnection, 'maps'); @@ -36,7 +45,8 @@ class MapsController $maps[] = $map; } - $data = ['maps' => $maps]; + $user = $this->request->user(); + $data = ['maps' => $maps, 'isAdmin' => $user !== null && $user->hasPermission(IUser::PERMISSION_ADMIN)]; return new HtmlContent('maps', $data); } diff --git a/views/admin/map_editor.php b/views/admin/map_editor.php index cea6b25..4358017 100644 --- a/views/admin/map_editor.php +++ b/views/admin/map_editor.php @@ -3,7 +3,7 @@
TODO
-= $map['description'] ?>