mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Prefill new pages with book's default template
This commit is contained in:
parent
1dbc3588cf
commit
99ae759eff
@ -148,6 +148,12 @@ class PageRepo
|
|||||||
$page->book_id = $parent->id;
|
$page->book_id = $parent->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($page->book->defaultTemplate) {
|
||||||
|
$page->forceFill([
|
||||||
|
'html' => $page->book->defaultTemplate->html,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$page->save();
|
$page->save();
|
||||||
$page->refresh()->rebuildPermissions();
|
$page->refresh()->rebuildPermissions();
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ class PageController extends Controller
|
|||||||
$page = $this->pageRepo->getNewDraftPage($parent);
|
$page = $this->pageRepo->getNewDraftPage($parent);
|
||||||
$this->pageRepo->publishDraft($page, [
|
$this->pageRepo->publishDraft($page, [
|
||||||
'name' => $request->get('name'),
|
'name' => $request->get('name'),
|
||||||
'html' => '',
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return redirect($page->getUrl('/edit'));
|
return redirect($page->getUrl('/edit'));
|
||||||
|
Loading…
Reference in New Issue
Block a user