FEATURE: add unlimited depth of subpages

This commit is contained in:
Michal Kváček
2016-04-05 21:42:22 +02:00
parent 9570ad3da3
commit 7446e2f4ef
3 changed files with 10 additions and 2 deletions
@@ -56,7 +56,7 @@ class CreateNewContent extends Controller
'templates' => $templates, 'templates' => $templates,
'moduleId' => $moduleId, 'moduleId' => $moduleId,
'page' => $this->content, 'page' => $this->content,
'rootPages' => $this->content->rootPages(), 'rootPages' => $this->content->getOverview()->get(),
'moduleName' => trans($module->name), 'moduleName' => trans($module->name),
'extraData' => call_user_func([$module->handler, 'loadExtraData'], $this->content), 'extraData' => call_user_func([$module->handler, 'loadExtraData'], $this->content),
'formSectionNames' => call_user_func([$module->handler, 'getExtendedFormSections']), 'formSectionNames' => call_user_func([$module->handler, 'getExtendedFormSections']),
+3 -1
View File
@@ -64,7 +64,9 @@ class EditContent extends Controller
return view('admin.content.edit', [ return view('admin.content.edit', [
'contentStatuses' => $statuses, 'contentStatuses' => $statuses,
'page' => $page, 'page' => $page,
'rootPages' => $page->rootPages(), 'rootPages' => $page->getOverview()
->where('contents.id', '!=', $page->id)
->get(),
'templates' => $templates, 'templates' => $templates,
'extraData' => call_user_func([$page->module_handler, 'loadExtraData'], $page), 'extraData' => call_user_func([$page->module_handler, 'loadExtraData'], $page),
'formSectionNames' => call_user_func([$page->module_handler, 'getExtendedFormSections']), 'formSectionNames' => call_user_func([$page->module_handler, 'getExtendedFormSections']),
+6
View File
@@ -82,6 +82,12 @@ class Content extends Model
$this->subpages = $this->getPageQuery() $this->subpages = $this->getPageQuery()
->where('parent_id', $this->id) ->where('parent_id', $this->id)
->get(); ->get();
// convert JSON settings into stdClass
foreach ($this->subpages as $subpage) {
$subpage->module_settings = json_decode($subpage->module_settings);
}
$this->subpagesInit = true; $this->subpagesInit = true;
} }