This add-on enhances Cockpit CMS by providing the ability to persist automatically changes on collection entries or singletons form data. That means if the user closes by mistake the browser (by mistake or by a system failure) the changes will not be lost and when someone tries to edit the same resource, the system will ask if he wants to continue from a previous saved version.
Download latest release and extract to COCKPIT_PATH/addons/Autosave directory
git clone https://github.com/pauloamgomes/CockpitCMS-Autosave.git ./addons/Autosavephp ./cp install/addon --name Autosave --url https://github.com/pauloamgomes/CockpitCMS-Autosave.git- Make sure path to cockpit addons is defined in your projects' composer.json file:
{
"name": "MY_PROJECT",
"extra": {
"installer-paths": {
"cockpit/addons/{$name}": ["type:cockpit-module"]
}
}
}- In your project root run:
composer require pauloamgomes/cockpitcms-autosaveIn order to use the addon, it's required to specifiy in the Cockpit config the collections and/or singletons we want to autosave, e.g.:
autosave:
collections: *
singletons:
- settings
- seoIn the above example we are saying to apply Autosave to all collections (use of *) and to specifically the singletons with name "settings" and "seo".
For non admin users its required to provide a permission ("access"), e.g.:
groups:
editor:
autosave:
access: trueWhen enabled, the addon will provide a small sidebar block that will display status of autosaves user did:
When using Autosave, only a version is stored in the database containing the latest changes user did in the resource. When user saves the resource, the autosave entry is automatically removed.
Copyright 2019 pauloamgomes under the MIT license.