mediawiki-extensions-Visual.../modules/ve-mw/ui/widgets/ve.ui.MWReferenceGroupInputWidget.js
James D. Forrester 7317114187 Update VE core submodule to master (029fc7e)
New changes:
029fc7e Update OOjs UI to v0.1.0-pre (1fa4eb7a73)

Update changes:
Changes were generated by running this script:
https://gist.github.com/trevorparscal/265f1b8c854190637a1e

File changes:

Scripts (modules/ve-mw/ui/widgets)
- ve.ui.MWInternalLinkMenuItemWidget.js → ve.ui.MWInternalLinkMenuOptionWidget.js
- ve.ui.MWLinkMenuItemWidget.js → ve.ui.MWLinkMenuOptionWidget.js

File content changes:

Scripts (*.js)
- MWInternalLinkMenuItemWidget → MWInternalLinkMenuOptionWidget
- MWLinkMenuItemWidget → MWLinkMenuOptionWidget
- ContextMenuWidget → ContextSelectWidget
- ContextItemWidget → ContextOptionWidget
- TextInputMenuWidget → TextInputMenuSelectWidget
- MenuWidget → MenuSelectWidget
- MenuItemWidget → MenuOptionWidget
- MenuSectionItemWidget → MenuSectionOptionWidget
- OutlineWidget → OutlineSelectWidget
- OutlineItemWidget → OutlineOptionWidget

Styles (*.less)
- contextMenuWidget → contextSelectWidget
- contextItemWidget → contextOptionWidget
- textInputMenuWidget → textInputMenuSelectWidget
- menuWidget → menuSelectWidget
- menuItemWidget → menuOptionWidget
- menuSectionItemWidget → menuSectionOptionWidget
- outlineWidget → outlineSelectWidget
- outlineItemWidget → outlineOptionWidget

Change-Id: Ifded7f9e17923dbb56a722b7424ccd2854194c21
2014-11-19 17:04:26 -08:00

60 lines
1.7 KiB
JavaScript

/*!
* VisualEditor UserInterface MWReferenceGroupInput class.
*
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Creates an ve.ui.MWReferenceGroupInput object.
*
* @class
* @extends OO.ui.ComboBoxWidget
*
* @constructor
* @param {Object} [config] Configuration options
* @cfg {string} emptyGroupName Label of the placeholder item
*/
ve.ui.MWReferenceGroupInputWidget = function VeUiMWReferenceGroupInput( config ) {
config = config || {};
this.emptyGroupName = config.emptyGroupName;
// Parent constructor
OO.ui.ComboBoxWidget.call( this, $.extend( true, { input: { placeholder: config.emptyGroupName } }, config ) );
this.$element.addClass( 've-ui-mwReferenceGroupInputWidget' );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWReferenceGroupInputWidget, OO.ui.ComboBoxWidget );
/* Methods */
/**
* Populate the reference group menu
*
* @param {ve.dm.InternalList} internalList Internal list with which to populate the menu
*/
ve.ui.MWReferenceGroupInputWidget.prototype.populateMenu = function ( internalList ) {
var placeholderGroupItem = new OO.ui.MenuOptionWidget( '', {
$: this.$,
label: this.emptyGroupName,
flags: 'emptyGroupPlaceholder'
} );
this.menu.clearItems();
this.menu.addItems( [ placeholderGroupItem ].concat( $.map(
Object.keys( internalList.getNodeGroups() ),
function ( groupInternalName ) {
if ( groupInternalName.indexOf( 'mwReference/' ) === 0 ) {
var groupName = groupInternalName.substring( 'mwReference/'.length );
if ( groupName ) {
return new OO.ui.MenuOptionWidget( groupName, { label: groupName } );
}
}
}
) ), 0 );
this.menu.toggle( false );
};