Define isdirty isdirtywithcookie ischangedfromdefault metasave
All of these terms are part of our way of understanding what saved-state an app is in.
- When an app is first created there is only backup_content.
- Once an app is published, the backup_content is pasted into the content.
- The content is what is viewable on the view page.
- Backup_content is what is visible on standalone.
- Editing in popout settings publishes every time!
- Editing in standalone (when not an admin) will auto save changes to backup_content, but will not publish to content unless the user clicks the publish button - this will pass the "opts.powr_published" to model.doSave
At different points of development we need to know what state the app is in, we use the following terms to track this:
. .
. .
isDirty​
Is stored in locals and means you have made changes that have not been saved yet. This became less important after autosave was introduced. . .
. .
isDirtyWithCookie​
Function does two things:
- sets 'isDirty' in locals to true.
- sets 'isChangedFromDefault' in locals to true.
- Creates cookie ('unpublished_content' saved with app type and app id) is for the recover plugin modal for when a logged out user abandons work on a plugin and then returns to the standalone for that same plugin type.
.
.
. .
isDirtyNoMoreWithCookie​
Function that:
- destroys the 'unpublished_content' cookie for that app type.
- sets 'isDirty' in local to false
.
.​
. .
isChangedFromDefault​
This is set in locals. It is the state when a user has interacted with the settings panel - this DOES NOT include changing templates. Templates are just switching between different defaults.
When changing between templates, you want the new template to show in the view - to make that happen, you must call model.triggerChange. By default triggerChanges has an argument of true for autosave/cookie_flag - this autosave is what calls isDirtyWithCookie - to prevent this behavior for changing templates, we must call model.triggerChange(false).
.
.​
. .
META.saved​
This is set to true on the model during autosave. This can happen from user interaction or from any function that called autoSave - this is NOT an accurate assessment that a user has interacted with an app.
. .