NCEAS / metacatui

MetacatUI: A client-side web interface for DataONE data repositories
https://nceas.github.io/metacatui
Apache License 2.0
42 stars 26 forks source link

Add ability to delete Markdown sections #1000

Closed laurenwalker closed 4 years ago

laurenwalker commented 5 years ago

When "Delete" is clicked, a confirmation message is displayed (maybe as a tooltip?) If confirmed, the ProjEditorSectionsView will remove the ProjEditorSectionView and it's corresponding ProjectSectionModel from the ProjectModel.

laurenwalker commented 4 years ago

I'm going to separate the Hide and Delete features into separate tickets. This ticket will be just for the feature to delete markdown sections.

The feature to hide Data and Metrics tabs are in the new ticket #1080

laurenwalker commented 4 years ago

A lot of the code that went into completing #1080 has paved the way for this ticket. Namely, the PortEditorSectionsView now has a listener for clicks on the "Delete" menu option, which calls PortEditorSectionsView.removeSection(). The PortalModel.removeSection() function should be fleshed out to delete Markdown sections from the model. Then the PortEditorSectionsView will need to remove the section link and section content from the webpage. I added a PortEditorSectionsView.removeSectionLink() function that should be reused to remove the section link. We should set a listener in the PortEditorSectionsView to listen to sections that are removed from the PortalModel, and remove the sections from the PortEditorSectionsView in a callback function.

rushirajnenuji commented 4 years ago

Hi Lauren - I've added the functionality to delete Markdown sections with the above commit: https://github.com/NCEAS/metacatui/commit/dfb8d70ebd96d72a189560eee794662eda868cd2

rushirajnenuji commented 4 years ago

Sorry - I re-read the description and noticed that I missed adding the confirmation message before deleting the section.

Are we thinking of a modal or a tooltip?

laurenwalker commented 4 years ago

Ideally, it would be great to have an "Undo" action rather than a confirmation message, but a confirmation is probably faster to implement. Let's go with a Bootstrap popover.

laurenwalker commented 4 years ago

Is there any update on this ticket? Let me know if you're experiencing any trouble spots I can help with.

rushirajnenuji commented 4 years ago

Hi Lauren - this issue is ready for review.

laurenwalker commented 4 years ago

I find the delete confirm message to be unintuitive and difficult to hover over. I also don't think we need to ask confirmation for the Data and Metrics pages since they don't have any unsaved content that would be lost, unlike the Markdown pages.

I'll work on making the confirmation message easier to use.