From 4eed4489f42a1fa2fb448b750acebf50ffed5b43 Mon Sep 17 00:00:00 2001 From: ro Date: Fri, 15 Mar 2024 15:18:10 -0600 Subject: [PATCH] page options fixes with the archive template up and running a bug with page creation and editing was revealed which was certain options were not being set correctly due to property not being set correctly when an markdown page was being edited. also added a null state check for page submissions that do not have a layout set, so it defaults to 'page' also patched theme service class to look for blade templates instead of twig, which it was still doing --- app/Http/Controllers/Dash/IndexController.php | 3 ++- app/Repositories/PageRepository.php | 6 +++++- app/Services/DocService.php | 2 +- app/Services/ThemeService.php | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Dash/IndexController.php b/app/Http/Controllers/Dash/IndexController.php index fdc7d5c..9fc0a4a 100644 --- a/app/Http/Controllers/Dash/IndexController.php +++ b/app/Http/Controllers/Dash/IndexController.php @@ -67,9 +67,10 @@ class IndexController extends Controller $title; $page = []; $views = []; - $mode == 'edit' ? $page = $this->pages->getById($uuid)->first() : $page = []; + $mode == 'edit' ? $page = $this->pages->getById($uuid) : $page = []; $mode == 'edit' ? $title = $page['title'] : $title = 'Add New'; $mode == 'edit' ? $views = $this->themes->getCustomViews($page['layout']) : $views[] = 'page'; + return view('back.page', [ "status" => $this->auth::status(), "mode" => $mode, diff --git a/app/Repositories/PageRepository.php b/app/Repositories/PageRepository.php index dd819a1..17b1027 100644 --- a/app/Repositories/PageRepository.php +++ b/app/Repositories/PageRepository.php @@ -45,7 +45,10 @@ class PageRepository implements PageRepositoryInterface public function getById($uuid) { - return $this->pages->where('uuid', $uuid); + $page = $this->pages->where('uuid', $uuid)->first(); + //quick check to see if layout is set + $page['layout'] == '' ? $page['layout'] = 'page' : $page['layout'] = $page['layout']; + return $page; } public function delete($uuid) @@ -74,6 +77,7 @@ class PageRepository implements PageRepositoryInterface $file; $writePath; $message; + $deleted; if ($task != 'create') { $path = date('Y', date($page['rawCreated'])) . '/' . diff --git a/app/Services/DocService.php b/app/Services/DocService.php index 6914889..f3ff4d7 100644 --- a/app/Services/DocService.php +++ b/app/Services/DocService.php @@ -155,7 +155,7 @@ class DocService $object->menu . "\n" . 'published: ' . - $object->menu . + $object->published . "\n" . 'featured: ' . $object->featured . diff --git a/app/Services/ThemeService.php b/app/Services/ThemeService.php index 6145915..a7ebf9c 100644 --- a/app/Services/ThemeService.php +++ b/app/Services/ThemeService.php @@ -44,7 +44,7 @@ class ThemeService { $currentTheme = $this->settings->getGlobal()['theme']; $folder = '../content/themes/' . $currentTheme; - $files = array_filter(glob("$folder/*twig"), 'is_file'); + $files = array_filter(glob("$folder/*blade.php"), 'is_file'); $views = []; foreach ($files as $file) { @@ -62,7 +62,7 @@ class ThemeService { $currentTheme = $this->settings->getGlobal()['theme']; $folder = '../content/themes/' . $currentTheme; - $files = array_filter(glob("$folder/*twig"), 'is_file'); + $files = array_filter(glob("$folder/*blade.php"), 'is_file'); $views = []; foreach ($files as $file) {