Update perform-edits-dialog.js to trap [RETURN] in editSummary and proceed to action (#2550)
* Update perform-edits-dialog.js Adding PerformEditsDialog.doFormSubmit() to share with keypress() [RETURN] from editField and « Edit Uploads ». * var doFormSubmit = function()… Change PerformEditsDialog.doFormSubmit to var doFormSubmit = function() * Update perform-edits-dialog.js Convert [TAB] to 2x [SPACE]. * Update perform-edits-dialog.js Move evt.preventDefault(); to where it belongs. * Update perform-edits-dialog.js Spacing corrections. * Update perform-edits-dialog.js Spacing corrections.
This commit is contained in:
parent
bf84fc9cf1
commit
da5bdcfdad
@ -18,54 +18,60 @@ PerformEditsDialog.launch = function(logged_in_username, max_severity) {
|
|||||||
this._elmts.performEditsButton.text($.i18n('perform-wikidata-edits/perform-edits'));
|
this._elmts.performEditsButton.text($.i18n('perform-wikidata-edits/perform-edits'));
|
||||||
this._elmts.cancelButton.text($.i18n('perform-wikidata-edits/cancel'));
|
this._elmts.cancelButton.text($.i18n('perform-wikidata-edits/cancel'));
|
||||||
|
|
||||||
|
var hiddenIframe = $('#hiddenIframe').contents();
|
||||||
|
|
||||||
var dismiss = function() {
|
var dismiss = function() {
|
||||||
DialogSystem.dismissUntil(self._level - 1);
|
DialogSystem.dismissUntil(self._level - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var doFormSubmit = 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 {
|
||||||
|
Refine.postProcess(
|
||||||
|
"wikidata",
|
||||||
|
"perform-wikibase-edits",
|
||||||
|
{},
|
||||||
|
{ summary: elmts.editSummary.val(), },
|
||||||
|
{ includeEngine: true, cellsChanged: true, columnStatsChanged: true },
|
||||||
|
{ onDone: function() { dismiss(); } }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
elmts.loggedInUsername
|
elmts.loggedInUsername
|
||||||
.text(logged_in_username)
|
.text(logged_in_username)
|
||||||
.attr('href','https://www.wikidata.org/wiki/User:'+logged_in_username);
|
.attr('href','https://www.wikidata.org/wiki/User:'+logged_in_username);
|
||||||
|
|
||||||
frame.find('.cancel-button').click(function() {
|
frame.find('.cancel-button').click(function() {
|
||||||
dismiss();
|
dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
var hiddenIframe = $('#hiddenIframe').contents();
|
this._elmts.editSummary.keypress(function (evt) {
|
||||||
|
if (evt.which === 13) {
|
||||||
|
doFormSubmit();
|
||||||
|
evt.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (max_severity === 'CRITICAL') {
|
if (max_severity === 'CRITICAL') {
|
||||||
elmts.performEditsButton.prop("disabled",true).addClass("button-disabled");
|
elmts.performEditsButton.prop("disabled",true).addClass("button-disabled");
|
||||||
} else {
|
} else {
|
||||||
elmts.performEditsButton.click(function() {
|
elmts.performEditsButton.click(function() {
|
||||||
hiddenIframe.find('body').append(
|
doFormSubmit();
|
||||||
elmts.performEditsForm.clone());
|
|
||||||
var formCopy = hiddenIframe.find("#wikibase-perform-edits-form");
|
|
||||||
formCopy.submit();
|
|
||||||
|
|
||||||
if(elmts.editSummary.val().length == 0) {
|
|
||||||
elmts.editSummary.focus();
|
|
||||||
} else {
|
|
||||||
Refine.postProcess(
|
|
||||||
"wikidata",
|
|
||||||
"perform-wikibase-edits",
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
summary: elmts.editSummary.val(),
|
|
||||||
},
|
|
||||||
{ includeEngine: true, cellsChanged: true, columnStatsChanged: true },
|
|
||||||
{ onDone:
|
|
||||||
function() {
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PerformEditsDialog.updateEditCount = function(edit_count) {
|
PerformEditsDialog.updateEditCount = function(edit_count) {
|
||||||
this._elmts.reviewYourEdits.html(
|
this._elmts.reviewYourEdits.html(
|
||||||
$.i18n('perform-wikidata-edits/review-your-edits')
|
$.i18n('perform-wikidata-edits/review-your-edits')
|
||||||
.replace('{nb_edits}', edit_count));
|
.replace('{nb_edits}', edit_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformEditsDialog._updateWarnings = function(data) {
|
PerformEditsDialog._updateWarnings = function(data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user