-
Notifications
You must be signed in to change notification settings - Fork 60
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
Bugfix: Prevent delete a template when has children #2479
Bugfix: Prevent delete a template when has children #2479
Conversation
to prevent the "delete" action being displayed for templates that have child templates.
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.
Everything works as expected. Awesome!
I have done something similar for users where I went with a name like: UmbTemplateAllowDeleteActionCondition
.
In the user case I had multiple conditions I needed to check so I combined them into one. It will make it possible to add tests where it might be difficult when they are split in JSON. Sometimes the server also sends a "canDelete/canEdit" etc. value we need to include in the check.
Just for the sake of sharing ideas: I think a "hasChildren/noChildren" condition will make sense though. I would just make it very general with its own "hasChildren"-context so it can be used in trees, workspaces, collections, etc.
How does that sound to you?
it didn't have any configurable properties. Lazy-loaded the manifest api.
to "Template Allow Delete Action" condition.
@madsrasmussen Thanks for the feedback, I've updated accordingly. |
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.
fantastic 💯
* Adds "Template Has No Children Condition" to prevent the "delete" action being displayed for templates that have child templates. * Removed condition config type it didn't have any configurable properties. Lazy-loaded the manifest api. * Renamed "Template Has No Children" condition to "Template Allow Delete Action" condition.
Description
Partial fix for umbraco/Umbraco-CMS#16443
When a template has child templates, the Delete action is available, (which would delete the parent template and orphan the child templates).
This PR adds a Template Has No Children Condition to prevent the Delete action being displayed for templates that have child templates.
Types of changes
How to test?