User:Chaotic Enby/Unblock wizard.js: Difference between revisions

From Test Wiki
Content deleted Content added
consistency
by aasim
Line 69: Line 69:
"status-redirecting": "Submission succeeded. Redirecting you to your talk page ...",
"status-redirecting": "Submission succeeded. Redirecting you to your talk page ...",
"status-redirecting-utrs": "Redirecting you to UTRS ...",
"status-redirecting-utrs": "Redirecting you to UTRS ...",
"status-not-blocked": "You are not currently blocked.",
"status-not-blocked": "You are not currently blocked. Click \"Confirm\" to activate demo mode, which will allow you to check out the workflow without posting a block request.",
"status-error": "Due to an error, your unblock request could not be parsed. You can try to submit an unblock request manually by pasting the following on [[Special:MyTalk|your talk page]]:<br /><code>{{unblock | reason=Your reason here ~~" + "~~}}</code><br />If you are having difficulties, please [https://utrs-beta.wmflabs.org/ make a request through UTRS] and inform them of the issues you are encountering.",
"status-error": "Due to an error, your unblock request could not be parsed. You can try to submit an unblock request manually by pasting the following on [[Special:MyTalk|your talk page]]:<br /><code>{{unblock | reason=Your reason here ~~" + "~~}}</code><br />If you are having difficulties, please [https://utrs-beta.wmflabs.org/ make a request through UTRS] and inform them of the issues you are encountering.",
"captcha-label": "Please enter the letters appearing in the box below",
"captcha-label": "Please enter the letters appearing in the box below",
Line 130: Line 130:
}
}
console.log(blockType)
console.log(blockType)
console.log(demoMode)
blockType = blockType[blockType.length - 1];
blockType = blockType[blockType.length - 1];
if (blockType != "IP" && !("id" in block) && !demoMode) {
demoMode = confirm(msg('status-not-blocked'));
}
console.log(demoMode)
switch (blockType) {
switch (blockType) {
case "Sockpuppet":
case "Sockpuppet":
Line 360: Line 363:
mainPosition = ui.fieldset.items.length;
mainPosition = ui.fieldset.items.length;
ui.fieldset.addItems([
ui.fieldset.addItems([
ui.mainStatusLayout = new OO.ui.FieldLayout(ui.mainStatusArea = new OO.ui.LabelWidget({
ui.mainStatusLayout = new OO.ui.FieldsetLayout( {
align: 'top',
label: $('<tr>').append('<td style="vertical-align:top; padding-right: 5px;">' + imglink(infoLevels[type]) + '</td><td style="vertical-align:middle;">' + linkify(message)+ '</td>')
}), {
icon: type,
label: $("<span/>").append(linkify(message))
align: 'top'
})
})
]);
]);
} else {
} else {
ui.mainStatusLayout.setIcon(type);
ui.mainStatusArea.setLabel($('<tr>').append('<td style="vertical-align:top; padding-right: 5px;">' + imglink(infoLevels[type]) + '</td><td style="vertical-align:middle;">' + linkify(message)+ '</td>'));
ui.mainStatusLayout.setLabel($('<span/>').append(linkify(message)));
}
}
}
}
Line 373: Line 377:
function handleSubmit() {
function handleSubmit() {


setMainStatus('process', msg('status-processing'));
setMainStatus('ellipsis', msg('status-processing'));
mw.track('counter.gadget_afcsw.submit_attempted');
mw.track('counter.gadget_afcsw.submit_attempted');
ui.submitButton.setDisabled(true);
ui.submitButton.setDisabled(true);
Line 385: Line 389:
location.href = "https://utrs-beta.wmflabs.org/public/appeal/account";
location.href = "https://utrs-beta.wmflabs.org/public/appeal/account";
}, config.redirectionDelay);
}, config.redirectionDelay);
} else if (blockType != "IP" && !("id" in block) && !demoMode) {
setMainStatus('warning', msg('status-not-blocked'));
} else {
} else {
for(var [i, label] of questionLabels.entries()){
for(var [i, label] of questionLabels.entries()){
Line 394: Line 396:
}
}
if (emptyFields && !emptyFieldsWarned) {
if (emptyFields && !emptyFieldsWarned) {
setMainStatus('warning', msg('status-blank'));
setMainStatus('alert', msg('status-blank'));
emptyFieldsWarned = true;
emptyFieldsWarned = true;
ui.submitButton.setDisabled(false);
ui.submitButton.setDisabled(false);
Line 424: Line 426:
var text = prepareUserTalkText();
var text = prepareUserTalkText();
setMainStatus('process', msg('status-saving'));
setMainStatus('ellipsis', msg('status-saving'));
if (demoMode) {
if (demoMode) {
setMainStatus('success', '<code style="display: block">' + text + '</code>');
setMainStatus('success', '<code style="display: block">' + text + '</code>');