Merge pull request #1678 from OpenRefine/issue1659

Save the schema before exporting to QuickStatements. Closes #1659.
This commit is contained in:
Jacky 2018-07-15 16:28:23 -04:00 committed by GitHub
commit 8f5fa97a3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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(); }
}, },
] ]