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.
symfony-version
Ro 2 years ago
parent 735117fcda
commit 48e447beba

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

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

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

Loading…
Cancel
Save