diff --git a/brain/controller/APIControl.inc.php b/brain/controller/APIControl.inc.php
index c55e7bd..a881b7e 100644
--- a/brain/controller/APIControl.inc.php
+++ b/brain/controller/APIControl.inc.php
@@ -27,8 +27,8 @@ class APIControl
ResponseInterface $response,
array $args
): ResponseInterface {
- $contentType = $request->getHeaderLine("Content-Type");
- switch ($contentType) {
+ $contentType = $request->getHeader("Content-Type");
+ switch ($contentType[0]) {
case "application/json":
$body = json_decode(file_get_contents("php://input"), true);
break;
diff --git a/brain/controller/DashControl.inc.php b/brain/controller/DashControl.inc.php
index 5455535..6b514db 100644
--- a/brain/controller/DashControl.inc.php
+++ b/brain/controller/DashControl.inc.php
@@ -30,11 +30,43 @@ class DashControl
"paginate" => $data["paginate"],
];
break;
+ case "page":
+ if (Session::active()) {
+ $template = "dash/page-edit.twig";
+ $mode = $args["third"];
+ if ($mode == "edit") {
+ $uuid = $args["fourth"];
+
+ $pageOptions = [
+ "title" => "Fipamo | Edit Page",
+ "page" => (new Book("../content/pages"))->findPageById($uuid),
+ "mode" => $mode,
+ ];
+ } else {
+ $pageOptions = [
+ "title" => "Fipamo | Create Page",
+ "mode" => $mode,
+ ];
+ }
+ } else {
+ $template = "dash/start.twig";
+ $pageOptions = [
+ "title" => "Welcome to Fipamo",
+ "status" => Session::active(),
+ ];
+ }
+
+ break;
+ case "logout":
+ Session::kill();
+ header("Location: /dashboard");
+ die();
+ break;
default:
$template = "dash/start.twig";
if (Session::active()) {
$pageOptions = [
- "title" => "Welcome to Fipamo",
+ "title" => "Welcome Back",
"status" => Session::active(),
"data" => (new Book("../content/pages"))->getPages(1, 4),
];
diff --git a/brain/data/Book.inc.php b/brain/data/Book.inc.php
index 3c547c6..7f94027 100644
--- a/brain/data/Book.inc.php
+++ b/brain/data/Book.inc.php
@@ -3,6 +3,7 @@
use Mni\FrontYAML\Parser;
use function _\orderBy;
use function _\filter;
+use function _\find;
class Book
{
@@ -25,6 +26,13 @@ class Book
}
}
+ public function findPageById(string $uuid)
+ {
+ $content = $this->getContents();
+ $page = find($content, ["uuid" => $uuid]);
+ return $page;
+ }
+
public function getPages(int $page, int $limit, string $sort = null)
{
$content = $this->getContents();
diff --git a/brain/views/dash/_frame.twig b/brain/views/dash/_frame.twig
index 47cf39d..d96b0ad 100644
--- a/brain/views/dash/_frame.twig
+++ b/brain/views/dash/_frame.twig
@@ -32,7 +32,13 @@
-
+
+ {% if status %}
+ {% apply spaceless %}
+ {{ include("dash/partials/navigation.twig") }}
+ {% endapply %}
+ {% endif %}
+
diff --git a/brain/views/dash/page-edit.twig b/brain/views/dash/page-edit.twig
new file mode 100644
index 0000000..a136ae6
--- /dev/null
+++ b/brain/views/dash/page-edit.twig
@@ -0,0 +1,96 @@
+{% extends "dash/_frame.twig" %}
+{#
+ if page is in 'edit' mode, set variables
+ if not, just make them empty
+#}
+{% if mode == 'edit' %}
+ {% set id = page['id'] %}
+ {% set uuid = page['uuid'] %}
+ {% set slug = page['slug'] %}
+ {% set feature = page['feature'] %}
+ {% set _title = page['title'] %}
+ {% set tags = page['tags'] %}
+ {% set content = page['content'] %}
+{% else %}
+ {% set id = '' %}
+ {% set uuid = '' %}
+ {% set slug = '' %}
+ {% set feature = '' %}
+ {% set title = '' %}
+ {% set tags = '' %}
+ {% set content = '' %}
+{% endif %}
+
+{% block title %}
+ {{ title }}
+{% endblock %}
+
+{% block stylesheets %}
+
+ {% endblock %}
+
+ {% block mainContent %}
+
+
+
+ {% if page['feature'] == null %}
+
+ DRAG AND DROP IMAGE OR
+
+ CLICK TO CHOSE
+
+ {% else %}
+
+
+
+
+
+
+
+
+
+ {% endif %}
+
+
+
+
+ {% apply spaceless %}
+ {{ include("dash/partials/editor.twig") }}
+ {% endapply %}
+
+
+
+
+ {% endblock %}
+
+ {% block javascripts %}
+
+ {% endblock %}
\ No newline at end of file
diff --git a/brain/views/dash/partials/editor.twig b/brain/views/dash/partials/editor.twig
new file mode 100644
index 0000000..50013d7
--- /dev/null
+++ b/brain/views/dash/partials/editor.twig
@@ -0,0 +1,45 @@
+
+ B
+ I
+ D
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% if mode == "edit" %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% else %}
+
+
+
+
+
+ {% endif %}
+
+
+
+
\ No newline at end of file
diff --git a/brain/views/dash/partials/navigation.twig b/brain/views/dash/partials/navigation.twig
new file mode 100644
index 0000000..31a008e
--- /dev/null
+++ b/brain/views/dash/partials/navigation.twig
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/brain/views/dash/partials/options.twig b/brain/views/dash/partials/options.twig
new file mode 100644
index 0000000..7e8f257
--- /dev/null
+++ b/brain/views/dash/partials/options.twig
@@ -0,0 +1,35 @@
+{% if page['menu'] %}
+ {% set menu = 'true' %}
+{% else %}
+ {% set menu = 'false' %}
+{% endif %}
+
+{% if page['featured'] %}
+ {% set featured = 'true' %}
+{% else %}
+ {% set featured = 'false' %}
+{% endif %}
+
+{% if page['published'] %}
+ {% set published = 'true' %}
+{% else %}
+ {% set published = 'false' %}
+{% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/brain/views/dash/start.twig b/brain/views/dash/start.twig
index d453d61..86cd36a 100644
--- a/brain/views/dash/start.twig
+++ b/brain/views/dash/start.twig
@@ -5,7 +5,7 @@
{% endblock %}
{% block stylesheets %}
-
+
{% endblock %}
{% block mainContent %}
diff --git a/src/styles/main/_posts.sass b/src/styles/main/_posts.sass
index 93c0292..102f8bc 100644
--- a/src/styles/main/_posts.sass
+++ b/src/styles/main/_posts.sass
@@ -189,7 +189,7 @@
button:nth-child(1)
border-radius: 3px 0 0 3px
- button:nth-child(4)
+ button:nth-child(3)
border-radius: 0 3px 3px 0
button
diff --git a/src/styles/main/_structure.sass b/src/styles/main/_structure.sass
index 9fcf94b..65ced4b 100644
--- a/src/styles/main/_structure.sass
+++ b/src/styles/main/_structure.sass
@@ -104,7 +104,7 @@ svg.icons
padding: 0.75rem
#left, #right
- width: 50%
+ width: 49.7%
display: inline-block
vertical-align: top
min-height: 60px