[PR #4750] [MERGED] Added Default Templates for Chapters #6406

Closed
opened 2026-02-05 10:31:24 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/4750
Author: @Man-in-Black
Created: 1/2/2024
Status: Merged
Merged: 2/1/2024
Merged by: @ssddanbrown

Base: developmentHead: chapter-templates


📝 Commits (6)

  • 70bfebc Added Default Templates for Chapters
  • 8c6b116 Update TrashCan.php
  • 0fc02a2 fixed error from phpcs
  • 2a84989 Update entities.php
  • 64c783c extraded template form to own file and changed translations
  • 4a8f702 added template to chapter API controller

📊 Changes

12 files changed (+146 additions, -41 deletions)

View changed files

📝 app/Entities/Controllers/ChapterApiController.php (+14 -12)
📝 app/Entities/Controllers/ChapterController.php (+8 -6)
📝 app/Entities/Controllers/PageController.php (+7 -2)
📝 app/Entities/Models/Chapter.php (+11 -0)
📝 app/Entities/Repos/ChapterRepo.php (+34 -0)
📝 app/Entities/Repos/PageRepo.php (+7 -1)
📝 app/Entities/Tools/TrashCan.php (+4 -0)
database/migrations/2024_01_01_104542_add_default_template_to_chapters.php (+32 -0)
📝 lang/en/entities.php (+4 -4)
📝 resources/views/books/parts/form.blade.php (+2 -16)
📝 resources/views/chapters/parts/form.blade.php (+9 -0)
resources/views/entities/template-selector.blade.php (+14 -0)

📄 Description

I have extended the new feature of default templates for books to chapters.
This makes it possible to specify default templates within individual chapters of a book so that they are automatically selected when a new page is created.
The functionality is exactly the same as with books.
Here is an excerpt from my bookstack (in german):
image
Behind the scenes I've made changes to the controller, the repos, the models and the trash can.
There is also a migration file for the database to alter the table for the chapters so that you can set the default_template_id.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/4750 **Author:** [@Man-in-Black](https://github.com/Man-in-Black) **Created:** 1/2/2024 **Status:** ✅ Merged **Merged:** 2/1/2024 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `development` ← **Head:** `chapter-templates` --- ### 📝 Commits (6) - [`70bfebc`](https://github.com/BookStackApp/BookStack/commit/70bfebcd7c9396c9d17757ec57a584371dce2e9f) Added Default Templates for Chapters - [`8c6b116`](https://github.com/BookStackApp/BookStack/commit/8c6b1164724fffd1766792fb3d6fef4972ba1b9e) Update TrashCan.php - [`0fc02a2`](https://github.com/BookStackApp/BookStack/commit/0fc02a2532fd33c443838de77f5700df220b79c9) fixed error from phpcs - [`2a84989`](https://github.com/BookStackApp/BookStack/commit/2a849894bee6ac7846261938c9606fb18a4a1761) Update entities.php - [`64c783c`](https://github.com/BookStackApp/BookStack/commit/64c783c6f8efb351dd73a1cfb4b5f214a731bd57) extraded template form to own file and changed translations - [`4a8f702`](https://github.com/BookStackApp/BookStack/commit/4a8f70240fd01f28980dfd4031c7df2b1db4949a) added template to chapter API controller ### 📊 Changes **12 files changed** (+146 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `app/Entities/Controllers/ChapterApiController.php` (+14 -12) 📝 `app/Entities/Controllers/ChapterController.php` (+8 -6) 📝 `app/Entities/Controllers/PageController.php` (+7 -2) 📝 `app/Entities/Models/Chapter.php` (+11 -0) 📝 `app/Entities/Repos/ChapterRepo.php` (+34 -0) 📝 `app/Entities/Repos/PageRepo.php` (+7 -1) 📝 `app/Entities/Tools/TrashCan.php` (+4 -0) ➕ `database/migrations/2024_01_01_104542_add_default_template_to_chapters.php` (+32 -0) 📝 `lang/en/entities.php` (+4 -4) 📝 `resources/views/books/parts/form.blade.php` (+2 -16) 📝 `resources/views/chapters/parts/form.blade.php` (+9 -0) ➕ `resources/views/entities/template-selector.blade.php` (+14 -0) </details> ### 📄 Description I have extended the new feature of default templates for books to chapters. This makes it possible to specify default templates within individual chapters of a book so that they are automatically selected when a new page is created. The functionality is exactly the same as with books. Here is an excerpt from my bookstack (in german): <img width="411" alt="image" src="https://github.com/BookStackApp/BookStack/assets/9048534/45c3054f-079c-45b8-aa89-57a64d5189a4"> Behind the scenes I've made changes to the controller, the repos, the models and the trash can. There is also a migration file for the database to alter the table for the chapters so that you can set the default_template_id. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:31:24 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6406