Codelabz
Codelabz copied to clipboard
move to trash fixed
Description
When navigating to the "My Tutorials" page and creating a tutorial, clicking the "Move to Trash" button doesn't behave as expected. This pull request addresses the issue and provides the following changes:
- If the tutorial is already published, the "Move to Trash" button is now disabled and not clickable.
- If the tutorial is unpublished, clicking the "Move to Trash" button triggers a modal dialog to confirm deletion.
- Upon confirming deletion in the modal, the user is redirected to the tutorial homepage or an appropriate page.
Related Issue
#935 fixed
Motivation and Context
This change is required to provide users with the expected behavior when dealing with tutorials. It solves the problem of the "Move to Trash" button not working as intended.
How Has This Been Tested?
I have tested these changes as follows:
- Created a new tutorial and ensured that the "Move to Trash" button is disabled when the tutorial is published.
- Created a new tutorial and confirmed that a modal dialog appears to confirm deletion when the tutorial is unpublished.
- Confirmed that upon confirming deletion, the user is redirected to the appropriate page.
Screenshots or GIF (In case of UI changes):
https://github.com/scorelab/Codelabz/assets/90304648/b55abe25-ee7f-4eba-a3b4-8d3cbf04ea48
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.