Save the schema before exporting to QuickStatements. Closes #1659.

This commit is contained in:
Antonin Delpeuch 2018-07-13 18:21:38 +01:00
parent 9f7d5b8786
commit 492a42a3c3

View File

@ -21,7 +21,7 @@ ExporterManager.MenuItems.push(
{ {
"id" : "exportQuickStatements", "id" : "exportQuickStatements",
"label": $.i18n._('wikidata-extension')["quickstatements-export-name"], "label": $.i18n._('wikidata-extension')["quickstatements-export-name"],
"click": function() { WikibaseExporterMenuBar.exportTo("quickstatements"); } "click": function() { WikibaseSchemaExporterMenuBar.checkSchemaAndExport(); }
} }
); );
@ -54,6 +54,19 @@ WikibaseExporterMenuBar.exportTo = function(format) {
document.body.removeChild(form); document.body.removeChild(form);
}; };
WikibaseExporterMenuBar.checkSchemaAndExport = function() {
var onSaved = function(callback) {
WikibaseExporterMenuBar.exportTo("quickstatements");
};
if (!SchemaAlignmentDialog.isSetUp()) {
SchemaAlignmentDialog.launch(null);
} else if (SchemaAlignmentDialog._hasUnsavedChanges) {
SchemaAlignmentDialog._save(onSaved);
} else {
onSaved();
}
}
//extend the column header menu //extend the column header menu
$(function(){ $(function(){
@ -80,7 +93,7 @@ $(function(){
{ {
id:"wikidata/export-qs", id:"wikidata/export-qs",
label: $.i18n._('wikidata-extension')["export-to-qs"], label: $.i18n._('wikidata-extension')["export-to-qs"],
click: function() { WikibaseExporterMenuBar.exportTo("quickstatements"); } click: function() { WikibaseExporterMenuBar.checkSchemaAndExport(); }
}, },
] ]