Enable file input on import schema dialog.
This commit is contained in:
parent
825c4ad213
commit
8bed3022a1
@ -2,7 +2,7 @@
|
||||
"wikidata-extension": {
|
||||
"menu-label": "Wikidata",
|
||||
"edit-wikidata-schema": "Edit Wikidata schema",
|
||||
"import-wikidata-schema": "Import Wikidata schema",
|
||||
"import-wikidata-schema": "Import schema",
|
||||
"manage-wikidata-account": "Manage Wikidata account",
|
||||
"perform-edits-on-wikidata": "Upload edits to Wikidata",
|
||||
"export-to-qs": "Export to QuickStatements",
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div class="dialog-frame" style="width: 800px;">
|
||||
<div class="dialog-header" bind="dialogHeader"></div>
|
||||
<div class="dialog-body" bind="dialogBody">
|
||||
<label for="schema-file" bind="fileLabel"></label><input type="file" name="schema-file" /><br />
|
||||
<label for="schema-file" bind="fileLabel"></label><input type="file" name="schema-file" bind="fileInput" /><br />
|
||||
<label for="schema" bind="schemaLabel"></label><br />
|
||||
<textarea name="schema" class="wikibase-schema-textarea" bind="schemaTextarea"></textarea><br />
|
||||
<div class="wikibase-invalid-schema" bind="invalidSchema"></div>
|
||||
|
@ -22,6 +22,17 @@ ImportSchemaDialog.launch = function() {
|
||||
dismiss();
|
||||
});
|
||||
|
||||
elmts.fileInput.on("change", function(evt) {
|
||||
var file = evt.target.files[0];
|
||||
var freader = new FileReader();
|
||||
freader.onload = function(evt) {
|
||||
elmts.schemaTextarea.val(evt.target.result);
|
||||
elmts.schemaTextarea.hide();
|
||||
elmts.schemaLabel.hide();
|
||||
}
|
||||
freader.readAsText(file);
|
||||
});
|
||||
|
||||
elmts.importButton.click(function() {
|
||||
var schema = null;
|
||||
try {
|
||||
|
@ -98,15 +98,21 @@ $(function(){
|
||||
label: $.i18n._('wikidata-extension')["edit-wikidata-schema"],
|
||||
click: function() { SchemaAlignmentDialog.launch(false); }
|
||||
},
|
||||
{
|
||||
id:"wikidata/manage-account",
|
||||
label: $.i18n._('wikidata-extension')["manage-wikidata-account"],
|
||||
click: function() { ManageAccountDialog.checkAndLaunch(); }
|
||||
},
|
||||
{},
|
||||
{
|
||||
id: "wikidata/import-schema",
|
||||
label: $.i18n._('wikidata-extension')["import-wikidata-schema"],
|
||||
click: function() { ImportSchemaDialog.launch(); }
|
||||
},
|
||||
{
|
||||
id:"wikidata/manage-account",
|
||||
label: $.i18n._('wikidata-extension')["manage-wikidata-account"],
|
||||
click: function() { ManageAccountDialog.checkAndLaunch(); }
|
||||
{
|
||||
id:"wikidata/export-schema",
|
||||
label: $.i18n._('wikidata-extension')["export-schema"],
|
||||
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("wikibase-schema"); }
|
||||
},
|
||||
{},
|
||||
{
|
||||
@ -119,11 +125,6 @@ $(function(){
|
||||
label: $.i18n._('wikidata-extension')["export-to-qs"],
|
||||
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("quickstatements"); }
|
||||
},
|
||||
{
|
||||
id:"wikidata/export-schema",
|
||||
label: $.i18n._('wikidata-extension')["export-schema"],
|
||||
click: function() { WikibaseExporterMenuBar.checkSchemaAndExport("wikibase-schema"); }
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user