Add schema unsaved warning
This commit is contained in:
parent
d8d7e82be1
commit
eed1049df3
@ -46,8 +46,8 @@
|
|||||||
"reset-button": "Reset",
|
"reset-button": "Reset",
|
||||||
"save-button": "Save",
|
"save-button": "Save",
|
||||||
"close-button": "Close",
|
"close-button": "Close",
|
||||||
"unsaved-changes": "There are unsaved changes. Close anyway?",
|
"incomplete-schema-could-not-be-saved": "Your schema is incomplete so it cannot be saved yet.",
|
||||||
"incomplete-schema-could-not-be-saved": "Your schema is incomplete so it cannot be saved yet."
|
"unsaved-warning": "You have made unsaved changes to your Wikidata schema. Close anyway?"
|
||||||
},
|
},
|
||||||
"wikidata-preview": {
|
"wikidata-preview": {
|
||||||
"new-id": "new item"
|
"new-id": "new item"
|
||||||
|
@ -176,6 +176,14 @@ SchemaAlignmentDialog.launch = function(onDone) {
|
|||||||
this._reset(theProject.overlayModels.wikibaseSchema, true);
|
this._reset(theProject.overlayModels.wikibaseSchema, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$(window).bind('beforeunload', function(e) {
|
||||||
|
if (SchemaAlignmentDialog.isSetUp() && SchemaAlignmentDialog._hasUnsavedChanges) {
|
||||||
|
return (e = $.i18n._('wikidata-schema')["unsaved-warning"]);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
SchemaAlignmentDialog._reset = function(schema, initial) {
|
SchemaAlignmentDialog._reset = function(schema, initial) {
|
||||||
this._originalSchema = schema || { itemDocuments: [] };
|
this._originalSchema = schema || { itemDocuments: [] };
|
||||||
this._schema = cloneDeep(this._originalSchema); // this is what can be munched on
|
this._schema = cloneDeep(this._originalSchema); // this is what can be munched on
|
||||||
|
Loading…
Reference in New Issue
Block a user