apostrophe icon indicating copy to clipboard operation
apostrophe copied to clipboard

I should be able to clear a singleton back to it's empty state (0.5)

Open benirose opened this issue 11 years ago • 2 comments

As an opt-in feature, we want to add a feature to allow clearing a singleton back to it's original state. This is especially pertinent for embed widgets where there is no way to clear out a video or embed. This is taken care of for us in areas, because you can simply delete the item from the area.

If the feature is turned on via the options of the aposSingleton call, the widget will include a trashcan icon to the right, similarly to how area-item widgets display them. The trash can will delete the singleton completely from the db, and it will return to the same state it was when it was empty. If the singleton is empty, no trashcan icon will be available.

Steps to make this happen: -Add markup for the UI to singleton.html in the apostrophe core -Update apos.enableSingletons method in user.js to hook a delete function to the UI -Add support for hiding the trash can when the singleton is empty

benirose avatar Oct 12 '15 21:10 benirose

It looks like areas don't have much of an API other than "save what you know", so there's not a hook currently to clear out an item in the area, or a singleton. We will have to write this.

benirose avatar Oct 12 '15 21:10 benirose

@benirose This feature exists for 0.6 singletons, which have been refactored to act as a special case of areas. Not sure if we'll backport this feature at this point in time.

jth- avatar Jan 15 '16 21:01 jth-