Merge pull request #1789 from OpenRefine/issue1778

Enable autocomplete for Wikidata upload form
This commit is contained in:
Antonin Delpeuch 2018-11-01 12:05:13 +00:00 committed by GitHub
commit 218e0adb15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

View File

@ -6,12 +6,15 @@
<div class="perform-edits-warnings-area" bind="warningsArea">
</div>
<div class="wikibase-perform-edits-area">
<form id="wikibase-perform-edits-form" onsubmit="return false;" bind="performEditsForm" autocomplete="on">
<p><span bind="loggedInAs"></span> <a bind="loggedInUsername" target="_blank"></a>.</p>
<p><span bind="editSummaryLabel"></span> <input type="text" name="editSummary" bind="editSummary" class="edit-summary" value="" /></p>
<div class="wikibase-login-buttons">
<button class="button cancel-button" bind="cancelButton"></button>
<button class="button button-primary" bind="performEditsButton"></button>
</div>
</form>
<iframe id="hiddeniframe" src="javascript:false" class="hidden" bind="hiddenIframe"></iframe>
</div>
</div>
</div>

View File

@ -30,10 +30,17 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
dismiss();
});
var hiddenIframe = $('#hiddenIframe').contents();
if (max_severity === 'CRITICAL') {
elmts.performEditsButton.prop("disabled",true).addClass("button-disabled");
} else {
elmts.performEditsButton.click(function() {
hiddenIframe.find('body').append(
elmts.performEditsForm.clone());
var formCopy = hiddenIframe.find("#wikibase-perform-edits-form");
formCopy.submit();
if(elmts.editSummary.val().length == 0) {
elmts.editSummary.focus();
} else {
@ -51,6 +58,7 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
}
});
}
event.preventDefault();
});
}
};