Jump to content

Wikipedia:Workflow improvements

From Wikipedia, the free encyclopedia

Wikitext forms are awful! If I have to fill out another form that has {{subst:void}} or HTML comments everywhere, I'm going to get extremely irritated.

Let's replace wikitext forms with real forms. WP:RFPP is an example of this. You used to have to fill out this form, but now you can fill out this form.

There are multiple ways to proceed. We could go individually, process by process, making custom scripts for each. We could also try to come up with a way to let people specify a form in JSON, so that creating and editing forms would be easier. (Yes, this has been done before: for example, mw:Extension:FormWizard. But that's sort of stalled.)

We could go even further with the JSON idea: once you've specified a form, there should magically be a script that lets you review requests; there should be an archiving bot; and there should be a tool that lets you search through requests. Right now, for each process, these four things (requesting, responding, archiving, searching) all need to be done from scratch. That's a big waste of time.

So let's talk about this! The talk page is open for business.

Potential venues

[edit]

Timeline

[edit]

(Leaving out many previous attempts to do this, I'm sure...)

Shared functionality

[edit]
  1. Live preview. Perhaps have the user write a function to create the wikitext for the submission given the current state of the form inputs, then provide activatePreview(/* jQuery object */ previewContainerElement, /* function */ createSubmissionWikitext);?
  2. Automatically add signature where possible - and indicate this clearly in preview. ensureSignatureAtEnd(wikitext)?
  3. Input validations. Provide doesPageExist()?
  4. beforeunload handler: you shouldn't be able to accidentally navigate away from the form and lose any entered text. activateBeforeUnloadHandler(formContainer) (the handler goes through each form input and checks if any have non-default values)?
  5. Gracefully handling failures: If the browser crashes, you should be able to retrieve the "lost" content from the browser localStorage. If the submission failed for an unexpected reason, again the form contents entered should be recoverable. activateFormPersistence(formContainer) (every N seconds, or every keystroke (TBD), form inputs saved to localStorage)?
  6. Transcluding requests: transcludeUnderMarkerComment(...) (looks for exactly <!-- Add new entries below this line -->), transcludeUnderDateHeading(...) (for DYK or ITNC)
  7. Status log for displaying a list of status messages to the user as a request gets submitted
  8. ...

Sample script

[edit]
const MAIN_REQUEST_PAGE = '...';

function createSubmissionWikitext() {
    var wikitext = '';
    for (/* each form input */) {
        // modify wikitext appropriately
    }
    return ensureSignatureAtEnd(wikitext);
}

function validate() {
    // ... (display error messages as appropriate)
    return isValid;
}

function displayForm(formContainer) {
    // append each form input to formContainer, wiring up input validation

    activatePreview($("#preview"), createSubmissionWikitext);
    activateBeforeUnloadHandler(formContainer);
    activateFormPersistence(formContainer);

    $("#submit").click(function() {
        if (validate()) {
            var statusLog = startStatusLog();
            var requestSubpageName = MAIN_REQUEST_PAGE + '/' + $('#name').val(); // for example
            createRequestSubpage(requestSubpageName, createSubmissionWikitext(), statusLog, /* ... */);
            transcludeUnderMarkerComment(MAIN_REQUEST_PAGE, requestSubpageName, statusLog, /* ... */);
        }
    });
}

if (mw.config.get('wgArticleId') === /* form page */) {
    displayForm($('#form'));
}

See also

[edit]
  • mw:Flow (RIP - because this was in the original spec somewhere)