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
This commit is contained in:
ro 2024-03-15 15:18:10 -06:00
parent 2f2955e865
commit 4eed4489f4
No known key found for this signature in database
GPG key ID: 29B551CDBD4D3B50
4 changed files with 10 additions and 5 deletions

View file

@ -67,9 +67,10 @@ class IndexController extends Controller
$title; $title;
$page = []; $page = [];
$views = []; $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' ? $title = $page['title'] : $title = 'Add New';
$mode == 'edit' ? $views = $this->themes->getCustomViews($page['layout']) : $views[] = 'page'; $mode == 'edit' ? $views = $this->themes->getCustomViews($page['layout']) : $views[] = 'page';
return view('back.page', [ return view('back.page', [
"status" => $this->auth::status(), "status" => $this->auth::status(),
"mode" => $mode, "mode" => $mode,

View file

@ -45,7 +45,10 @@ class PageRepository implements PageRepositoryInterface
public function getById($uuid) 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) public function delete($uuid)
@ -74,6 +77,7 @@ class PageRepository implements PageRepositoryInterface
$file; $file;
$writePath; $writePath;
$message; $message;
$deleted;
if ($task != 'create') { if ($task != 'create') {
$path = date('Y', date($page['rawCreated'])) . $path = date('Y', date($page['rawCreated'])) .
'/' . '/' .

View file

@ -155,7 +155,7 @@ class DocService
$object->menu . $object->menu .
"\n" . "\n" .
'published: ' . 'published: ' .
$object->menu . $object->published .
"\n" . "\n" .
'featured: ' . 'featured: ' .
$object->featured . $object->featured .

View file

@ -44,7 +44,7 @@ class ThemeService
{ {
$currentTheme = $this->settings->getGlobal()['theme']; $currentTheme = $this->settings->getGlobal()['theme'];
$folder = '../content/themes/' . $currentTheme; $folder = '../content/themes/' . $currentTheme;
$files = array_filter(glob("$folder/*twig"), 'is_file'); $files = array_filter(glob("$folder/*blade.php"), 'is_file');
$views = []; $views = [];
foreach ($files as $file) { foreach ($files as $file) {
@ -62,7 +62,7 @@ class ThemeService
{ {
$currentTheme = $this->settings->getGlobal()['theme']; $currentTheme = $this->settings->getGlobal()['theme'];
$folder = '../content/themes/' . $currentTheme; $folder = '../content/themes/' . $currentTheme;
$files = array_filter(glob("$folder/*twig"), 'is_file'); $files = array_filter(glob("$folder/*blade.php"), 'is_file');
$views = []; $views = [];
foreach ($files as $file) { foreach ($files as $file) {