1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Default chapter templates: Updated api docs and tests

Also applied minor tweaks to some wording and logic.

During review of #4750
This commit is contained in:
Dan Brown
2024-02-01 12:22:16 +00:00
parent 4a8f70240f
commit 4137cf9c8f
10 changed files with 46 additions and 40 deletions

View File

@ -61,6 +61,8 @@ class ListingResponseBuilder
}
});
dd($data->first());
return response()->json([
'data' => $data,
'total' => $total,

View File

@ -136,13 +136,7 @@ class PageRepo
$page->book_id = $parent->id;
}
// check for chapter
if ($page->chapter_id) {
$defaultTemplate = $page->chapter->defaultTemplate;
} else {
$defaultTemplate = $page->book->defaultTemplate;
}
$defaultTemplate = $page->chapter->defaultTemplate ?? $page->book->defaultTemplate;
if ($defaultTemplate && userCan('view', $defaultTemplate)) {
$page->forceFill([
'html' => $defaultTemplate->html,