diff --git a/brain/controller/DashControl.inc.php b/brain/controller/DashControl.inc.php
index 7ded135..6a5d350 100644
--- a/brain/controller/DashControl.inc.php
+++ b/brain/controller/DashControl.inc.php
@@ -101,24 +101,47 @@ class DashControl
if (Session::active()) {
$template = "dash/page-edit.twig";
$mode = $args["third"];
- if ($mode == "edit") {
- $uuid = $args["fourth"];
- $customPages = (new Themes())->getCustomViews();
- $pageOptions = [
- "title" => "Fipamo | Edit Page",
- "page" => (new Book("../content/pages"))->findPageById($uuid),
- "mode" => $mode,
- "token" => Session::get("form_token"),
- "status" => Session::active(),
- "views" => $customPages,
- ];
- } else {
- $pageOptions = [
- "title" => "Fipamo | Create Page",
- "token" => Session::get("form_token"),
- "mode" => $mode,
- "status" => Session::active(),
- ];
+ $uuid = $args["fourth"];
+ switch ($mode) {
+ case "edit":
+ $customPages = (new Themes())->getCustomViews();
+ $pageOptions = [
+ "title" => "Fipamo | Edit Page",
+ "page" => (new Book("../content/pages"))->findPageById($uuid),
+ "mode" => $mode,
+ "token" => Session::get("form_token"),
+ "status" => Session::active(),
+ "views" => $customPages,
+ ];
+ break;
+ case "preview":
+ $config = new Settings();
+ $settings = $config->getSettings();
+ $loader = new \Twig\Loader\FilesystemLoader(
+ "../content/themes"
+ );
+ $display = new \Twig\Environment($loader, []);
+
+ $book = new Book("../content/pages");
+ $page = $book->findPageById($uuid);
+ $pageOptions = Sorting::page($page);
+ $preview =
+ $settings["global"]["theme"] .
+ "/" .
+ $page["layout"] .
+ ".twig";
+ $html = $display->render($preview, $pageOptions);
+ $response->getBody()->write($html);
+ return $response;
+ break;
+ default:
+ $pageOptions = [
+ "title" => "Fipamo | Create Page",
+ "token" => Session::get("form_token"),
+ "mode" => $mode,
+ "status" => Session::active(),
+ ];
+ break;
}
} else {
header("Location: /dashboard");
diff --git a/brain/controller/IndexControl.inc.php b/brain/controller/IndexControl.inc.php
index 4a0ded3..5643d85 100644
--- a/brain/controller/IndexControl.inc.php
+++ b/brain/controller/IndexControl.inc.php
@@ -63,6 +63,7 @@ class IndexControl
break;
default:
+ //check layout to see what page should be rendered
$template = $settings["global"]["theme"] . "/page.twig";
$book = new Book("../content/pages");
$page = $book->findPageBySlug($args["third"]);
diff --git a/brain/utility/Sorting.inc.php b/brain/utility/Sorting.inc.php
index 1e36121..ee9fe18 100644
--- a/brain/utility/Sorting.inc.php
+++ b/brain/utility/Sorting.inc.php
@@ -155,6 +155,7 @@ class Sorting
"ul",
"li",
"i",
+ "em",
"h1",
"h2",
"h3",
diff --git a/brain/views/dash/page-edit.twig b/brain/views/dash/page-edit.twig
index 56840a7..66c3474 100644
--- a/brain/views/dash/page-edit.twig
+++ b/brain/views/dash/page-edit.twig
@@ -30,7 +30,7 @@
{% endblock %}
{% block stylesheets %}
-
+
{% endblock %}
{% block mainContent %}
diff --git a/brain/views/dash/partials/options.twig b/brain/views/dash/partials/options.twig
index 68c452f..c8a0dfd 100644
--- a/brain/views/dash/partials/options.twig
+++ b/brain/views/dash/partials/options.twig
@@ -29,9 +29,16 @@
+
+
+