Add the possibility to delete pages in place from the tree #781
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request improves the user experience and robustness of deleting pages in the panel by introducing a dedicated modal for page deletion and enhancing both backend and frontend handling of delete actions, especially for AJAX (XHR) requests. The changes ensure that errors and success messages are communicated appropriately whether the action is performed via a standard HTTP request or an XHR request, and that the UI updates dynamically after deletion.
Backend enhancements for delete actions:
PagesController@deletemethod now returns JSON error responses for XHR requests when the page is not found, the language is invalid, or the page is not deletable, ensuring AJAX requests receive structured error feedback. [1] [2]panel.pages.deleteroute now explicitly supports both HTTP and XHR request types, clarifying its usage for AJAX operations.Frontend and modal improvements:
deletePageItem.yamlis added for deleting pages, with clear messaging and command handling.deletePageItemModalfor delete actions, and the modal is properly initialized in the TypeScript logic. [1] [2] [3]pages.ts) is updated to handle the new modal's open and command events, sending the delete request via AJAX, updating the UI to remove the deleted page, and showing notifications based on the server response.These changes collectively make page deletion more user-friendly, reliable, and consistent across different types of requests.