New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Default Templates for Chapters #4750
Added Default Templates for Chapters #4750
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Man-in-Black for this PR, it's looking good and generally all seems to work apart from one minor condition.
I've added a set of notes on the code to work through.
In addition to these, there are a couple of other areas that would need consideration:
- This functionality would need testing coverage. The tests for book templates can be found here. The tests would be similar, with crossover in testing, so that existing test file could just be changed to
DefaultTemplateTest
, withbook
added to the existing test case names if not already there. - The REST API needs to be considered, to allow templates to be set/updated for chapters via the API. The API examples, and tests, would then need to be updated to suit.
If you're unsure of anything written, need help, or would instead prefer me to take on the requested work, just let me know.
Thank you Dan for your comments, if it's okay for you I would to try to fix the parts you mentioned. |
Sure, sounds good! Happy to help and advise where needed. |
remove duplicate call of $page->forceDelete();
Hi @ssddanbrown I'm very happy that you accepted my first "bigger" PR :-) I'm trying to get into your comments and suggestions, but to be honest I'm struggling a bit at this point.
The most parts I've done comes from my former PHP knowledge, so it was doable for me. But some years passed since then and after I discovered your project I've started to get back into it, but I think it needs some more time. I hope this is okay for you and if I'm not able to resolve everything I would be happy if you can take on the work, I would then start to build up my knowledge on your changes. |
Sure, I have specific guidance covering exactly this on this page here. Let me know if there's something missing from that, or if you have trouble with any of the details there.
That might be all that's needed to be honest, most of the logic is handled in the repos so we can share it across the API and normal app code, we just have to make sure those properties are accepted through validation. In regard to testing the API changes, you can see my changes to
I'm not mad at all, happy to take the time where possible to get others involved and to help folks learn. |
changed text of `pages_delete_warning_template` to include chapters
Thanks for the guide. I followed it but I can't get it to run, I always get the following error:
Ok I've added the two lines that seemed right to me.
I'm very glad about that. I just commented on some of your comments to see if you can adopt them. |
Ah, you may still have PHP (composer) dependancies installed for production. By default, we state to run |
Thanks for the clarification. It realy installed some new packages. I think at the moment I've reached my limits in this regards and I do need to learn more about it before writing a valid test case. |
Also applied minor tweaks to some wording and logic. During review of #4750
- Updated existing book tests to be generic to all default templates, and updated with chapter testing. - Extracted repeated logic in the Book/Chapter repos to be shared in the BaseRepo. Review of #4750
Thanks again @Man-in-Black for offering this and progressing it upon my requests. My further changes can be seen in 4137cf9 and 43a72fb. |
Thanks @ssddanbrown for taking on this. |
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):
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.