From 395850adb8281e9a3d911cb906eed01fd5bf5f9b Mon Sep 17 00:00:00 2001 From: Ro Date: Sat, 10 Apr 2021 13:44:43 -0700 Subject: [PATCH] cleaned up date formatting for display --- brain/controller/DashControl.inc.php | 3 +++ brain/data/Book.inc.php | 6 ++---- brain/views/dash/page-edit.twig | 4 +++- brain/views/dash/partials/index.twig | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/brain/controller/DashControl.inc.php b/brain/controller/DashControl.inc.php index 6b514db..04930bf 100644 --- a/brain/controller/DashControl.inc.php +++ b/brain/controller/DashControl.inc.php @@ -28,6 +28,7 @@ class DashControl "stats" => $data["stats"], "pages" => $data["pages"], "paginate" => $data["paginate"], + "status" => Session::active(), ]; break; case "page": @@ -41,11 +42,13 @@ class DashControl "title" => "Fipamo | Edit Page", "page" => (new Book("../content/pages"))->findPageById($uuid), "mode" => $mode, + "status" => Session::active(), ]; } else { $pageOptions = [ "title" => "Fipamo | Create Page", "mode" => $mode, + "status" => Session::active(), ]; } } else { diff --git a/brain/data/Book.inc.php b/brain/data/Book.inc.php index 7f94027..fbf325a 100644 --- a/brain/data/Book.inc.php +++ b/brain/data/Book.inc.php @@ -118,8 +118,6 @@ class Book $doc = $parser->parse(file_get_contents($file), false); $meta = $doc->getYAML(); - //$date = getdate($meta["created"]); - $newDate = date("Y M D d", $meta["created"]); $page = [ "id" => $meta["id"], "uuid" => $meta["uuid"], @@ -129,8 +127,8 @@ class Book "layout" => $meta["layout"], "tags" => $meta["tags"], "author" => $meta["author"], - "prettyDate" => $newDate, - "created" => $meta["created"], + "created" => date("Y M D d", $meta["created"]), + "updated" => date("Y M D d", $meta["updated"]), "deleted" => $meta["deleted"], "menu" => $meta["menu"], "featured" => $meta["featured"], diff --git a/brain/views/dash/page-edit.twig b/brain/views/dash/page-edit.twig index a136ae6..e299485 100644 --- a/brain/views/dash/page-edit.twig +++ b/brain/views/dash/page-edit.twig @@ -11,6 +11,7 @@ {% set _title = page['title'] %} {% set tags = page['tags'] %} {% set content = page['content'] %} + {% set date = page['created'] %} {% else %} {% set id = '' %} {% set uuid = '' %} @@ -19,6 +20,7 @@ {% set title = '' %} {% set tags = '' %} {% set content = '' %} + {% set date = '' %} {% endif %} {% block title %} @@ -62,7 +64,7 @@
- PRETTY DATE + {{ date }}
diff --git a/brain/views/dash/partials/index.twig b/brain/views/dash/partials/index.twig index 20a4056..9148370 100644 --- a/brain/views/dash/partials/index.twig +++ b/brain/views/dash/partials/index.twig @@ -40,7 +40,7 @@ Featured
- {{ page.prettyDate }} + {{ page.updated }}