Switch render method

There were still some reference to the base Controller page renderer
that needed to switched to the new Render class. Oops.

Also for got mention tabler icons (https://tabler-icons.io/) were added
in the last commit. They are so nice.
This commit is contained in:
Ro 2023-01-08 14:49:54 -08:00
parent 735117fcda
commit 48e447beba
3 changed files with 34 additions and 35 deletions

View file

@ -113,11 +113,11 @@ class Locations extends AbstractController
$request->request->get("loc_tags") == ""
) {
$notice = "All fields are required, champ.";
return $this->render("back/locations.twig", [
"title" => "Bad Space | Locations | Add",
"notice" => $notice,
"mode" => "add"
]);
return $render->page(
["mode" => "add", "notice" => $notice],
"Bad Space | Locations | Add",
"back/locations.twig"
);
}
//once everything clears, upload images and process request
@ -132,29 +132,26 @@ class Locations extends AbstractController
}
$response = $locations->modifyLocation($request, $result["id"], $mode, $request->request->get("uuid"));
if ($response["status"]) {
$options = [];
if ($mode == 'add') {
$options = [
"title" => "Bad Space | Locations | Add",
"notice" => $response["message"],
"mode" => $mode
];
return $render->page(
["mode" => $mode, "notice" => $response["message"]],
"Bad Space | Locations | Add",
"back/locations.twig"
);
} else {
$location = $locations->getLocationbyUUID($request->request->get("uuid"));
$options = [
"title" => "Bad Space | Locations | Edit",
"mode" => $mode,
"notice" => $response["message"],
"location" => $location[0]
];
return $render->page(
["mode" => $mode, "notice" => $response["message"], "location" => $location[0]],
"Bad Space | Locations | Edit",
"back/locations.twig"
);
}
return $this->render("back/locations.twig", $options);
} else {
return $this->render("back/locations.twig", [
"title" => "Bad Space | Locations | Error",
"notice" => $response["message"],
"mode" => $mode
]);
return $render->page(
["mode" => $mode, "notice" => $response["message"]],
"Bad Space | Locations | Error",
"back/locations.twig"
);
}
}
} else {
@ -227,17 +224,17 @@ class Locations extends AbstractController
$response = $locations->addMultipleLocations($file, $result["id"]);
if ($response["status"]) {
$notice = "New locations added! Take a break.";
return $this->render("back/locations.twig", [
"title" => "Bad Space | Locations | Add",
"notice" => $response["message"],
"mode" => "bulk-add"
]);
return $render->page(
["mode" => "bulk-add", "notice" => $response["message"], ],
"Bad Space | Locations | Bulk Add",
"back/locations.twig"
);
} else {
return $this->render("back/locations.twig", [
"title" => "Bad Space | Locations | Add",
"notice" => $response["message"],
"mode" => "bulk-add"
]);
return $render->page(
["mode" => "bulk-add", "notice" => $response["message"], ],
"Bad Space | Locations | Bulk Add",
"back/locations.twig"
);
}
}
} else {

View file

@ -173,6 +173,8 @@ class HandleLocations
// Save image
//extract data row by row
//TODO: set name to lowercase for comparison
foreach ($records as $offset => $row) {
$name = $row["Name"];
$url = $row["Url"];

View file

@ -8,9 +8,9 @@
<h1>
Location Listing
</h1>
{% if notice is defined %}
{% if options.notice is defined %}
<div role="system-notice">
{{ notice }}
{{ options.notice }}
</div>
{% endif %}