Page MenuHomePhabricator

Implement standalone JavaScript version of mw.widgets.NamespaceInputWidget
Closed, ResolvedPublic

Description

Implement standalone JavaScript version of mw.widgets.NamespaceInputWidget. Currently, mw.widgets.NamespaceInputWidget is only usable if created by infusion of the PHP NamespaceInputWidget (added in 2ac9e2a4327af2102c20df5d186fc62858f0f9ca); the big problem is that in JavaScript, we have no way to build the list of namespaces. This would have to be implemented.

Details

Related Changes in Gerrit:

Event Timeline

matmarex raised the priority of this task from to Low.
matmarex updated the task description. (Show Details)
matmarex subscribed.

Building the list of namespaces seems easy enough:

items = $.map( mw.config.get( 'wgFormattedNamespaces' ), function ( name, ns ) {
    if ( ns === '0' ) {
        name = mw.message( 'blanknamespace' ).text();
    }
    return new OO.ui.MenuOptionWidget( { data: ns, label: name } );
} ).sort( function ( a, b ) {
    return a.data - b.data;
} );

Change 230821 had a related patch set uploaded (by Bartosz Dziewoński):
Refactor NamespaceInputWidget

https://gerrit.wikimedia.org/r/230821

Change 230821 merged by jenkins-bot:
Refactor NamespaceInputWidget

https://gerrit.wikimedia.org/r/230821