CSS Reshuffle, Added Page Renderer
Reorganized the CSS structure to there is some seperation between front facing style and the backend den. Also add the Render class so auth status is included in every template rendering event so login status and select member data is available if needed. will expand if needed.
This commit is contained in:
parent
26f3cbe994
commit
735117fcda
31 changed files with 11403 additions and 199 deletions
|
@ -11,9 +11,9 @@ section[role="den-login"] div[role="system-notice"] {
|
||||||
color: var(--primary);
|
color: var(--primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
section[role="den-index"],
|
section[role="den-index"] {
|
||||||
section[role="loc-index"] {
|
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
color: var(--white);
|
||||||
}
|
}
|
||||||
|
|
||||||
section a {
|
section a {
|
27
public/assets/css/back/locations.css
Normal file
27
public/assets/css/back/locations.css
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
section[role="loc-index"] {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="loc-index"] img {
|
||||||
|
width: 150px;
|
||||||
|
vertical-align: top;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="loc-index"] label {
|
||||||
|
color: var(--white);
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="loc-index"] input {
|
||||||
|
width: 290px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="loc-index"] textarea {
|
||||||
|
width: 290px;
|
||||||
|
padding: 5px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
section[role="loc-index"] select {
|
||||||
|
width: 150px;
|
||||||
|
}
|
7
public/assets/css/back/start.css
Normal file
7
public/assets/css/back/start.css
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
@import "../global/colors.css";
|
||||||
|
@import "../global/forms.css";
|
||||||
|
@import "../global/typography.css";
|
||||||
|
@import "../global/frame.css";
|
||||||
|
@import "../global/icons.css";
|
||||||
|
@import "locations.css";
|
||||||
|
@import "index.css";
|
|
@ -1,6 +1,7 @@
|
||||||
@import url("colors.css");
|
@import "../global/colors.css";
|
||||||
@import url("forms.css");
|
@import "../global/forms.css";
|
||||||
@import url("typography.css");
|
@import "../global/typography.css";
|
||||||
@import url("frame.css");
|
@import "../global/frame.css";
|
||||||
@import url("index.css");
|
@import "../global/icons.css";
|
||||||
@import url("index-den.css");
|
|
||||||
|
@import "index.css";
|
||||||
|
|
|
@ -28,6 +28,10 @@ header > nav {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header > nav i {
|
||||||
|
font-size: 1.3em;
|
||||||
|
}
|
||||||
|
|
||||||
header > nav > div[role="nav-right"] {
|
header > nav > div[role="nav-right"] {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
11148
public/assets/css/global/icons.css
Normal file
11148
public/assets/css/global/icons.css
Normal file
File diff suppressed because it is too large
Load diff
BIN
public/assets/css/global/type/tabler-icons.ttf
Normal file
BIN
public/assets/css/global/type/tabler-icons.ttf
Normal file
Binary file not shown.
BIN
public/assets/css/global/type/tabler-icons.woff
Normal file
BIN
public/assets/css/global/type/tabler-icons.woff
Normal file
Binary file not shown.
|
@ -10,30 +10,18 @@ use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\HttpFoundation\RequestStack;
|
use Symfony\Component\HttpFoundation\RequestStack;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
//use App\Utils\PageRender;
|
|
||||||
use App\Service\Auth;
|
use App\Service\Auth;
|
||||||
|
use App\Service\Render;
|
||||||
|
|
||||||
class Index extends AbstractController
|
class Index extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/den", name="back-index")
|
* @Route("/den", name="back-index")
|
||||||
*/
|
*/
|
||||||
public function enterTheDen(Request $request, Auth $auth, RequestStack $requestStack): Response
|
public function enterTheDen(Request $request, Auth $auth, RequestStack $requestStack, Render $render): Response
|
||||||
{
|
{
|
||||||
if ($request->getMethod() == "GET") {
|
if ($request->getMethod() == "GET") {
|
||||||
$result = $auth->status();
|
return $render->page([], "This is the Den", "back/index.twig");
|
||||||
if ($result["status"]) {
|
|
||||||
$session = $requestStack->getSession();
|
|
||||||
$member = $session->get("member");
|
|
||||||
return $this->render("back/start.twig", [
|
|
||||||
"title" => "Welcome Back",
|
|
||||||
"handle" => $member->getHandle()
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
return $this->render("back/index.twig", [
|
|
||||||
"title" => "Close the door behind you",
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
//handles login
|
//handles login
|
||||||
$handle = $request->request->get("handle");
|
$handle = $request->request->get("handle");
|
||||||
|
|
|
@ -13,10 +13,9 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
use App\Service\HandleLocations;
|
use App\Service\HandleLocations;
|
||||||
use Doctrine\DBAL\Connection;
|
use Doctrine\DBAL\Connection;
|
||||||
//use App\Utils\PageRender;
|
|
||||||
//use App\Utils\StringTools;
|
|
||||||
use App\Service\Auth;
|
use App\Service\Auth;
|
||||||
use App\Service\FileUploader;
|
use App\Service\FileUploader;
|
||||||
|
use App\Service\Render;
|
||||||
|
|
||||||
class Locations extends AbstractController
|
class Locations extends AbstractController
|
||||||
{
|
{
|
||||||
|
@ -39,6 +38,7 @@ class Locations extends AbstractController
|
||||||
HandleLocations $locations,
|
HandleLocations $locations,
|
||||||
ManagerRegistry $doctrine,
|
ManagerRegistry $doctrine,
|
||||||
Connection $connection,
|
Connection $connection,
|
||||||
|
Render $render,
|
||||||
string $pageNum
|
string $pageNum
|
||||||
): Response {
|
): Response {
|
||||||
$result = $auth->status();
|
$result = $auth->status();
|
||||||
|
@ -48,15 +48,7 @@ class Locations extends AbstractController
|
||||||
$list = $locations->getLocationsPage($pageNum);
|
$list = $locations->getLocationsPage($pageNum);
|
||||||
|
|
||||||
//$search = $connection->fetchAllAssociative("SELECT * FROM searchlocations('agenda')");
|
//$search = $connection->fetchAllAssociative("SELECT * FROM searchlocations('agenda')");
|
||||||
|
return $render->page(["list" => $list, "mode" => "index"], "Bad Space | Locations", "back/locations.twig");
|
||||||
//var_dump($search[0]["name"]);
|
|
||||||
|
|
||||||
return $this->render("back/locations.twig", [
|
|
||||||
"title" => "Bad Space | Locations",
|
|
||||||
"handle" => $member->getHandle(),
|
|
||||||
"list" => $list,
|
|
||||||
"mode" => "index"
|
|
||||||
]);
|
|
||||||
} else {
|
} else {
|
||||||
return $this->render("back/index.twig", [
|
return $this->render("back/index.twig", [
|
||||||
"title" => "Close the door behind you",
|
"title" => "Close the door behind you",
|
||||||
|
@ -65,27 +57,41 @@ class Locations extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/den/locations/add", name="location-add")
|
* @Route("/den/locations/modify/{action}/{uuid}", name="location-modify")
|
||||||
*/
|
*/
|
||||||
public function addLocation(
|
public function modifyLocation(
|
||||||
Request $request,
|
Request $request,
|
||||||
Auth $auth,
|
Auth $auth,
|
||||||
HandleLocations $locations,
|
HandleLocations $locations,
|
||||||
ManagerRegistry $doctrine,
|
ManagerRegistry $doctrine,
|
||||||
FileUploader $uploader
|
FileUploader $uploader,
|
||||||
|
Render $render,
|
||||||
|
string $action = "add",
|
||||||
|
string $uuid = "001"
|
||||||
): Response {
|
): Response {
|
||||||
$result = $auth->status();
|
$result = $auth->status();
|
||||||
if ($result["status"]) {
|
if ($result["status"]) {
|
||||||
if ($request->getMethod() == "GET") {
|
if ($request->getMethod() == "GET") {
|
||||||
return $this->render("back/locations.twig", [
|
$options = [];
|
||||||
"title" => "Bad Space | Locations | Add",
|
if ($action == 'add') {
|
||||||
"mode" => "add"
|
return $render->page(
|
||||||
]);
|
["mode" => $action],
|
||||||
|
"Bad Space | Locations | Add",
|
||||||
|
"back/locations.twig"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$location = $locations->getLocationbyUUID($uuid);
|
||||||
|
return $render->page(
|
||||||
|
["mode" => $action, "location" => $location[0]],
|
||||||
|
"Bad Space | Locations | Edit",
|
||||||
|
"back/locations.twig"
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//add new member
|
//add new member
|
||||||
$token = $request->get("token");
|
$token = $request->get("token");
|
||||||
$notice = "";
|
$notice = "";
|
||||||
$entityManager = $doctrine->getManager();
|
$mode = $request->get("mode");
|
||||||
|
|
||||||
//token check
|
//token check
|
||||||
if (!$this->isCsrfTokenValid("upload", $token)) {
|
if (!$this->isCsrfTokenValid("upload", $token)) {
|
||||||
|
@ -100,16 +106,6 @@ class Locations extends AbstractController
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$examples = [];
|
|
||||||
$files = $request->files->get("loc_examples");
|
|
||||||
if (!empty($files)) {
|
|
||||||
for ($i = 0; $i < count($files); $i++) {
|
|
||||||
$path = $files[$i]->getClientOriginalName();
|
|
||||||
array_push($examples, ["image_index" => $i, "path" => urlencode($path)]);
|
|
||||||
$uploader->uploadExamples("../public/assets/images/examples", $files[$i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$request->request->get("loc_name") == "" ||
|
$request->request->get("loc_name") == "" ||
|
||||||
$request->request->get("loc_url") == "" ||
|
$request->request->get("loc_url") == "" ||
|
||||||
|
@ -124,20 +120,40 @@ class Locations extends AbstractController
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//check clear, call add method
|
//once everything clears, upload images and process request
|
||||||
$response = $locations->addLocation($request, $result["id"]);
|
$examples = [];
|
||||||
|
$files = $request->files->get("loc_examples");
|
||||||
|
if (!empty($files)) {
|
||||||
|
for ($i = 0; $i < count($files); $i++) {
|
||||||
|
$path = $files[$i]->getClientOriginalName();
|
||||||
|
array_push($examples, ["image_index" => $i, "path" => urlencode($path)]);
|
||||||
|
$uploader->uploadExamples("../public/assets/images/examples", $files[$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$response = $locations->modifyLocation($request, $result["id"], $mode, $request->request->get("uuid"));
|
||||||
if ($response["status"]) {
|
if ($response["status"]) {
|
||||||
$notice = "New location added! Take a break.";
|
$options = [];
|
||||||
return $this->render("back/locations.twig", [
|
if ($mode == 'add') {
|
||||||
"title" => "Bad Space | Locations | Add",
|
$options = [
|
||||||
"notice" => $notice,
|
"title" => "Bad Space | Locations | Add",
|
||||||
"mode" => "add"
|
"notice" => $response["message"],
|
||||||
]);
|
"mode" => $mode
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$location = $locations->getLocationbyUUID($request->request->get("uuid"));
|
||||||
|
$options = [
|
||||||
|
"title" => "Bad Space | Locations | Edit",
|
||||||
|
"mode" => $mode,
|
||||||
|
"notice" => $response["message"],
|
||||||
|
"location" => $location[0]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $this->render("back/locations.twig", $options);
|
||||||
} else {
|
} else {
|
||||||
return $this->render("back/locations.twig", [
|
return $this->render("back/locations.twig", [
|
||||||
"title" => "Bad Space | Locations | Add",
|
"title" => "Bad Space | Locations | Error",
|
||||||
"notice" => $response["message"],
|
"notice" => $response["message"],
|
||||||
"mode" => "add"
|
"mode" => $mode
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,15 +172,17 @@ class Locations extends AbstractController
|
||||||
Auth $auth,
|
Auth $auth,
|
||||||
HandleLocations $locations,
|
HandleLocations $locations,
|
||||||
ManagerRegistry $doctrine,
|
ManagerRegistry $doctrine,
|
||||||
FileUploader $uploader
|
FileUploader $uploader,
|
||||||
|
Render $render
|
||||||
): Response {
|
): Response {
|
||||||
$result = $auth->status();
|
$result = $auth->status();
|
||||||
if ($result["status"]) {
|
if ($result["status"]) {
|
||||||
if ($request->getMethod() == "GET") {
|
if ($request->getMethod() == "GET") {
|
||||||
return $this->render("back/locations.twig", [
|
return $render->page(
|
||||||
"title" => "Bad Space | Locations | Bulk Add",
|
["mode" => "bulk-add"],
|
||||||
"mode" => "bulk-add"
|
"Bad Space | Locations | Bulk Add",
|
||||||
]);
|
"back/locations.twig"
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// do posting stuff
|
// do posting stuff
|
||||||
$token = $request->get("token");
|
$token = $request->get("token");
|
||||||
|
@ -227,29 +245,4 @@ class Locations extends AbstractController
|
||||||
return new Response("<html><body>LOGGED IN</body></html>");
|
return new Response("<html><body>LOGGED IN</body></html>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("/den/locations/edit/{uuid}", name="location-edit")
|
|
||||||
*/
|
|
||||||
public function editLocation(
|
|
||||||
Request $request,
|
|
||||||
Auth $auth,
|
|
||||||
HandleLocations $locations,
|
|
||||||
ManagerRegistry $doctrine,
|
|
||||||
FileUploader $uploader,
|
|
||||||
string $uuid = "1"
|
|
||||||
): Response {
|
|
||||||
$result = $auth->status();
|
|
||||||
if ($result["status"]) {
|
|
||||||
$location = $locations->getLocationbyUUID($uuid);
|
|
||||||
return $this->render("back/locations.twig", [
|
|
||||||
"title" => "Bad Space | Locations | Edit",
|
|
||||||
"mode" => "edit",
|
|
||||||
"location" => $location[0]
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
header("Location:/den");
|
|
||||||
return new Response("<html><body>LOGGED IN</body></html>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,37 +9,19 @@ use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use App\Service\Auth;
|
||||||
//use App\Utils\PageRender;
|
use App\Service\Render;
|
||||||
//use App\Data\Auth;
|
|
||||||
|
|
||||||
class Index extends AbstractController
|
class Index extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/", name="index")
|
* @Route("/", name="index")
|
||||||
*/
|
*/
|
||||||
public function showIndex(Request $request): Response
|
public function showIndex(Request $request, Auth $auth, Render $render): Response
|
||||||
{
|
{
|
||||||
return $this->render("front/index.twig", [
|
$check = $auth->status();
|
||||||
"title" => "This is The Bad Space",
|
|
||||||
]);
|
return $render->page([], "This is The Bad Space", "front/index.twig");
|
||||||
/*
|
|
||||||
$result = $auth->status();
|
|
||||||
if ($result["status"]) {
|
|
||||||
return $render->renderPage(
|
|
||||||
[
|
|
||||||
"bgImage" => "/images/base/tweed-flowers.png",
|
|
||||||
"role" => $result["role"],
|
|
||||||
],
|
|
||||||
"The Nile List | Welcome Back",
|
|
||||||
"front/index.html.twig"
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
//back to index to login
|
|
||||||
header("Location:/login");
|
|
||||||
return new Response("<html><body>LOGGED IN</body></html>");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -90,6 +90,7 @@ class Auth
|
||||||
"status" => true,
|
"status" => true,
|
||||||
"role" => $this->session->get("member")->getRole(),
|
"role" => $this->session->get("member")->getRole(),
|
||||||
"id" => $this->session->get("member")->getId(),
|
"id" => $this->session->get("member")->getId(),
|
||||||
|
"handle" => $this->session->get("member")->getHandle(),
|
||||||
"token" => $this->session->get("token"),
|
"token" => $this->session->get("token"),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -27,7 +27,7 @@ class FileUploader
|
||||||
public function uploadExamples($examplesDir, $file)
|
public function uploadExamples($examplesDir, $file)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$file->move($examplesDir, urldecode($file->getClientOriginalName()));
|
$file->move($examplesDir, urlencode($file->getClientOriginalName()));
|
||||||
} catch (FileException $e) {
|
} catch (FileException $e) {
|
||||||
$this->logger->error("failed to upload image: " . $e->getMessage());
|
$this->logger->error("failed to upload image: " . $e->getMessage());
|
||||||
throw new FileException("Failed to upload image file");
|
throw new FileException("Failed to upload image file");
|
||||||
|
|
|
@ -81,10 +81,14 @@ class HandleLocations
|
||||||
* @param Request $request object containing posted data
|
* @param Request $request object containing posted data
|
||||||
* @return JSON
|
* @return JSON
|
||||||
*/
|
*/
|
||||||
public function addLocation($request, $memberId)
|
public function modifyLocation($request, $memberId, $action, $uuid = 0)
|
||||||
{
|
{
|
||||||
$errorMessage = null;
|
$errorMessage = null;
|
||||||
$location = new Location();
|
if ($action == "add") {
|
||||||
|
$location = new Location();
|
||||||
|
} else {
|
||||||
|
$location = $this->entityManager->getRepository(Location::class)->findOneBy(["uuid" => $uuid]);
|
||||||
|
}
|
||||||
|
|
||||||
//submitted values
|
//submitted values
|
||||||
$name = $request->request->get("loc_name");
|
$name = $request->request->get("loc_name");
|
||||||
|
@ -109,13 +113,17 @@ class HandleLocations
|
||||||
}
|
}
|
||||||
|
|
||||||
//set defaults
|
//set defaults
|
||||||
$location->setUuid(Uuid::v4());
|
|
||||||
$location->setActive(false);
|
|
||||||
$location->setCreatedAt(new \DateTimeImmutable());
|
|
||||||
$location->setUpdatedAt(new \DateTimeImmutable());
|
$location->setUpdatedAt(new \DateTimeImmutable());
|
||||||
$location->setAddedBy($memberId);
|
if ($action == "add") {
|
||||||
|
$location->setUuid(Uuid::v4());
|
||||||
$this->entityManager->persist($location);
|
$location->setActive(false);
|
||||||
|
$location->setCreatedAt(new \DateTimeImmutable());
|
||||||
|
$location->setAddedBy($memberId);
|
||||||
|
$this->entityManager->persist($location);
|
||||||
|
} else {
|
||||||
|
$active = ($request->request->get("rating") == "true" ? true : false);
|
||||||
|
$location->setActive($active);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
@ -132,9 +140,15 @@ class HandleLocations
|
||||||
}
|
}
|
||||||
// return result status
|
// return result status
|
||||||
if ($errorMessage == null) {
|
if ($errorMessage == null) {
|
||||||
|
$message = "";
|
||||||
|
if ($action == "add") {
|
||||||
|
$message = "New location added. Woohoo!";
|
||||||
|
} else {
|
||||||
|
$message = "Location Updated! Water break!";
|
||||||
|
}
|
||||||
return $response = [
|
return $response = [
|
||||||
"status" => true,
|
"status" => true,
|
||||||
"message" => "New member added. Woohoo!",
|
"message" => $message,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
return $response = ["status" => false, "message" => $errorMessage];
|
return $response = ["status" => false, "message" => $errorMessage];
|
||||||
|
@ -185,10 +199,10 @@ class HandleLocations
|
||||||
$location->setRating($ratings);
|
$location->setRating($ratings);
|
||||||
|
|
||||||
//grab images, move them to dir and set image array
|
//grab images, move them to dir and set image array
|
||||||
foreach ($imgs as $img) {
|
foreach ($imgs as $key => $img) {
|
||||||
$imageName = uniqid() . ".jpg";
|
$imageName = uniqid() . ".jpg";
|
||||||
$path = "../public/assets/images/examples/" . $imageName;
|
$path = "../public/assets/images/examples/" . $imageName;
|
||||||
array_push($examples, $imageName);
|
array_push($examples, ["image_index" => $key, "path" => urlencode($imageName)]);
|
||||||
file_put_contents($path, file_get_contents(trim($img)));
|
file_put_contents($path, file_get_contents(trim($img)));
|
||||||
}
|
}
|
||||||
$location->setImages($examples);
|
$location->setImages($examples);
|
||||||
|
|
35
src/Service/Render.php
Normal file
35
src/Service/Render.php
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Service;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
|
||||||
|
class Render extends AbstractController
|
||||||
|
{
|
||||||
|
private $auth;
|
||||||
|
|
||||||
|
public function __construct(Auth $auth)
|
||||||
|
{
|
||||||
|
$this->auth = $auth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function page($options, $title, $template)
|
||||||
|
{
|
||||||
|
$loggedIn = false;
|
||||||
|
$role = 0;
|
||||||
|
$handle = "Random Person";
|
||||||
|
$result = $this->auth->status();
|
||||||
|
if ($result["status"]) {
|
||||||
|
$loggedIn = $result["status"];
|
||||||
|
$handle = $result["handle"];
|
||||||
|
$role = $result["role"];
|
||||||
|
}
|
||||||
|
return $this->render($template, [
|
||||||
|
"title" => $title,
|
||||||
|
"loggedIn" => $loggedIn,
|
||||||
|
"handle" => $handle,
|
||||||
|
"role" => $role,
|
||||||
|
"options" => $options,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,16 +1,30 @@
|
||||||
{% extends "base/frame.twig" %}
|
{% extends "base/frame.twig" %}
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
<link rel="stylesheet" type="text/css" href="/assets/css/front/start.css?=dfadf">
|
<link rel="stylesheet" type="text/css" href="/assets/css/back/start.css?=qwert">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<section role="den-login">
|
{% if loggedIn %}
|
||||||
<h1>This is the Den</h1><br/>
|
<section role="den-index">
|
||||||
{% if notice is defined %}
|
<h1>
|
||||||
<div role="system-notice">
|
Welcome to the Den,
|
||||||
{{ notice }}
|
{{ handle }}
|
||||||
</div>
|
|
||||||
{% endif %}
|
</h1>
|
||||||
{{ include("forms/login-form.twig") }}
|
Remember to pace yourself because you're working with some of the worse places on the web. Drink water, takes lot of breaks and remember you are the reason the interent is becoming safer.
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<section role="den-login">
|
||||||
|
<h1>This is the Den</h1><br/>
|
||||||
|
{% if notice is defined %}
|
||||||
|
<div role="system-notice">
|
||||||
|
{{ notice }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{{ include("forms/login-form.twig") }}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "base/frame.twig" %}
|
{% extends "base/frame.twig" %}
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
<link rel="stylesheet" type="text/css" href="/assets/css/front/start.css?=sdfsdf">
|
<link rel="stylesheet" type="text/css" href="/assets/css/back/start.css?=qwert">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
|
@ -14,26 +14,31 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if mode == "add" %}
|
{% if options.mode == "add" %}
|
||||||
<h2>Add New Location</h2>
|
<h2>Add New Location</h2>
|
||||||
{{ include("forms/add-location.twig") }}
|
{{ include("forms/add-location.twig") }}
|
||||||
{% elseif mode =='bulk-add' %}
|
{% elseif options.mode =='bulk-add' %}
|
||||||
<h2>Add Multiple Locations</h2>
|
<h2>Add Multiple Locations</h2>
|
||||||
{{ include("forms/bulk-add-location.twig") }}
|
{{ include("forms/bulk-add-location.twig") }}
|
||||||
{% elseif mode == "edit" %}
|
{% elseif options.mode == "edit" %}
|
||||||
<h2>Editing
|
<h2>Editing
|
||||||
{{ location.name }}</h2>
|
{{ options.location.name }}</h2>
|
||||||
|
{% for image in options.location.images %}
|
||||||
|
<a target="_blank" href="/assets/images/examples/{{ image.path }}">
|
||||||
|
<img src="/assets/images/examples/{{ image.path }}"/>
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
{{ include("forms/edit-location.twig") }}
|
{{ include("forms/edit-location.twig") }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<h2>Take care. These are bad places.</h2>
|
<h2>Take care. These are bad places.</h2>
|
||||||
<a href="/den/locations/add">Add Location</a>
|
<a href="/den/locations/modify/add">Add Location</a>
|
||||||
|
|
|
|
||||||
<a href="/den/locations/bulk-add">Add Multiple Locations</a>
|
<a href="/den/locations/bulk-add">Add Multiple Locations</a>
|
||||||
<br>
|
<br>
|
||||||
<h3>Bad Spaces</h3>
|
<h3>Bad Spaces</h3>
|
||||||
{% for location in list.locations %}
|
{% for location in options.list.locations %}
|
||||||
<sup>ID:{{ location.id }}</sup>
|
<sup>ID:{{ location.id }}</sup>
|
||||||
<a href="/den/locations/edit/{{ location.uuid }}">
|
<a href="/den/locations/modify/edit/{{ location.uuid }}">
|
||||||
|
|
||||||
{{ location.name }}</a><br/>
|
{{ location.name }}</a><br/>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "base/frame.twig" %}
|
{% extends "base/frame.twig" %}
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
<link rel="stylesheet" type="text/css" href="/assets/css/front/start.css?=sdfsdf">
|
<link rel="stylesheet" type="text/css" href="/assets/css/back/start.css?=qwert">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
{% extends "base/frame.twig" %}
|
|
||||||
{% block stylesheets %}
|
|
||||||
<link rel="stylesheet" type="text/css" href="/assets/css/front/start.css?=dfdferer">
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block main %}
|
|
||||||
<section role="den-index">
|
|
||||||
<h1>
|
|
||||||
Welcome to the Den.
|
|
||||||
|
|
||||||
</h1>
|
|
||||||
Remember to pace yourself because you're working with some of the worse places on the web. Drink water, takes lot of breaks and remember you are the reason the interent is becoming safer.
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
|
@ -13,28 +13,33 @@
|
||||||
<header>
|
<header>
|
||||||
<nav>
|
<nav>
|
||||||
<div role="nav-left">
|
<div role="nav-left">
|
||||||
<a href="/den">The Bad Space</a>
|
<i class="ti ti-biohazard-off"></i>
|
||||||
|
<a href="/">The Bad Space</a>
|
||||||
</div>
|
</div>
|
||||||
<div role="nav-right">
|
<div role="nav-right"></a>
|
||||||
|
|
||||||
{% if handle is defined %}
|
{% if loggedIn == true %}
|
||||||
<strong>Hey
|
<a href="/den" title="den index">
|
||||||
{{ handle }}
|
<i class="ti ti-door" title="den index"></i>
|
||||||
</strong>
|
|
||||||
{% endif %}
|
|
||||||
<a href="/den/members">Members
|
|
||||||
</a>
|
</a>
|
||||||
<a href="/den/locations/page/1">Locations
|
<a href="/den/members" title="members">
|
||||||
|
<i class="ti ti-users" title="members"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="/logout">Bye</a>
|
<a href="/den/locations/page/1" title="locations">
|
||||||
</div>
|
<i class="ti ti-list-details" title="locations"></i>
|
||||||
|
</a>
|
||||||
|
<a href="/logout" title="logout">
|
||||||
|
<i class="ti ti-door-exit" title="logout"></i>
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/den" title="login">
|
||||||
|
<i class="ti ti-door-enter" title="login"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</nav>
|
</div>
|
||||||
|
|
||||||
</header>
|
</nav>
|
||||||
<main>
|
|
||||||
{% block main %}{% endblock %}
|
|
||||||
</main>
|
|
||||||
{% block javascripts %}{% endblock %}
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html></header><main>
|
||||||
|
{% block main %}{% endblock %}</main>{% block javascripts %}{% endblock %}</body></html>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<form action="{{ path('location-add') }}" method="post" enctype="multipart/form-data">
|
<form action="{{ path('location-modify') }}" method="post" enctype="multipart/form-data">
|
||||||
<div>
|
<div>
|
||||||
<label>Name</label><br/>
|
<label>Name</label><br/>
|
||||||
<input type="text" name="loc_name" value=""/>
|
<input type="text" name="loc_name" value=""/>
|
||||||
|
@ -24,4 +24,5 @@
|
||||||
<input type="file" id="loc_examples" name="loc_examples[]" multiple/>
|
<input type="file" id="loc_examples" name="loc_examples[]" multiple/>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="token" value="{{ csrf_token('upload') }}"/>
|
<input type="hidden" name="token" value="{{ csrf_token('upload') }}"/>
|
||||||
|
<input type="hidden" name="mode" value="add"/>
|
||||||
<input type="submit" value="Edit Location" name="submit_button"></form>
|
<input type="submit" value="Edit Location" name="submit_button"></form>
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
<form action="{{ path('location-edit') }}" method="post" enctype="multipart/form-data">
|
<form name="edit" action="{{ path('location-modify') }}" method="post" enctype="multipart/form-data">
|
||||||
<div>
|
<div>
|
||||||
<label>Name</label><br/>
|
<label>Name</label><br/>
|
||||||
<input type="text" name="loc_name" value="{{ location.name }}"/>
|
<input type="text" name="loc_name" value="{{ options.location.name }}"/>
|
||||||
<br/>
|
<br/>
|
||||||
<label>URL</label><br/>
|
<label>URL</label><br/>
|
||||||
<input type="text" name="loc_url" value="{{ location.url }}"/>
|
<input type="text" name="loc_url" value="{{ options.location.url }}"/>
|
||||||
<br/>
|
<br/>
|
||||||
<label>Tags</label><br/>
|
<label>Tags</label><br/>
|
||||||
<input type="text" name="loc_tags" value="{{ location.tags }}"/>
|
<input type="text" name="loc_tags" value="{{ options.location.tags }}"/>
|
||||||
<br/>
|
<br/>
|
||||||
<label>Description</label><br/>
|
<label>Description</label><br/>
|
||||||
<textarea name="loc_desc">{{ location.description }}</textarea>
|
<textarea name="loc_desc">{{ options.location.description }}</textarea>
|
||||||
<br/>
|
<br/>
|
||||||
<label>Rating</label><br/>
|
<label>Rating</label><br/>
|
||||||
<select name="rating">
|
<select name="rating">
|
||||||
{% if location.rating == "silence" %}
|
{% if options.location.rating == "silence" %}
|
||||||
<option value="silence" selected>Silence</option>
|
<option value="silence" selected>Silence</option>
|
||||||
<option value="defederate">Defederate</option>
|
<option value="defederate">Defederate</option>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
</select><br/>
|
</select><br/>
|
||||||
<label>Include in search results</label><br/>
|
<label>Include in search results</label><br/>
|
||||||
<select name="active">
|
<select name="active">
|
||||||
{% if location.active %}
|
{% if options.location.active %}
|
||||||
<option value="false">No</option>
|
<option value="false">No</option>
|
||||||
<option value="true" selected>Yes</option>
|
<option value="true" selected>Yes</option>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -37,4 +37,6 @@
|
||||||
<input type="file" id="loc_examples" name="loc_examples[]" multiple/>
|
<input type="file" id="loc_examples" name="loc_examples[]" multiple/>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="token" value="{{ csrf_token('upload') }}"/>
|
<input type="hidden" name="token" value="{{ csrf_token('upload') }}"/>
|
||||||
|
<input type="hidden" name="mode" value="edit"/>
|
||||||
|
<input type="hidden" name="uuid" value="{{ options.location.uuid }}"/>
|
||||||
<input type="submit" value="Edit Location" name="submit_button"></form>
|
<input type="submit" value="Edit Location" name="submit_button"></form>
|
||||||
|
|
|
@ -9,5 +9,6 @@
|
||||||
Because some people are just awful humans.
|
Because some people are just awful humans.
|
||||||
<p>Coming Soonish...
|
<p>Coming Soonish...
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{% extends "base/frame.twig" %}
|
|
||||||
{% block stylesheets %}
|
|
||||||
<link rel="stylesheet" type="text/css" href="/assets/css/front/start.css?=sdfsdf">
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block main %}
|
|
||||||
<section role="intro">
|
|
||||||
This is where you login
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
Loading…
Reference in a new issue