Merge "Move MWReferenceSourceSelectWidget out to Citoid"

This commit is contained in:
jenkins-bot 2015-08-26 15:40:19 +00:00 committed by Gerrit Code Review
commit c010450e08
3 changed files with 0 additions and 116 deletions

View file

@ -489,8 +489,6 @@ class VisualEditorHooks {
'modules/ve-mw/ui/dialogs/ve.ui.MWReferencesListDialog.js',
'modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js',
'modules/ve-mw/ui/widgets/ve.ui.MWReferenceSourceSelectWidget.js',
'modules/ve-mw/ui/tools/ve.ui.MWReferenceDialogTool.js',
'modules/ve-mw/ui/tools/ve.ui.MWCitationDialogTool.js',
@ -504,7 +502,6 @@ class VisualEditorHooks {
'modules/ve-mw/ui/styles/widgets/ve.ui.MWReferenceGroupInputWidget.css',
'modules/ve-mw/ui/styles/widgets/ve.ui.MWReferenceResultWidget.css',
'modules/ve-mw/ui/styles/widgets/ve.ui.MWReferenceSearchWidget.css',
'modules/ve-mw/ui/styles/widgets/ve.ui.MWReferenceSourceSelectWidget.css',
),
'dependencies' => array(
'ext.visualEditor.mwreference.core',

View file

@ -1,10 +0,0 @@
/*!
* VisualEditor MediaWiki UserInterface MWReferenceSearchWidget styles.
*
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
.ve-ui-mwReferenceSourceSelectWidget-separator {
border-top: 1px solid #ccc;
}

View file

@ -1,103 +0,0 @@
/*!
* VisualEditor UserInterface MWReferenceSourceSelectWidget class.
*
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Creates an ve.ui.MWReferenceSourceSelectWidget object.
*
* @class
* @extends OO.ui.SearchWidget
*
* @constructor
* @param {Object} [config] Configuration options
* @cfg {boolean} [showExisting] Show 're-use existing reference' as an option
*/
ve.ui.MWReferenceSourceSelectWidget = function VeUiMWReferenceSourceSelectWidget( config ) {
var i, len, tools, item, limit,
items = [];
config = config || {};
// Parent constructor
ve.ui.MWReferenceSourceSelectWidget.super.call( this, config );
limit = ve.init.target.constructor.static.citationToolsLimit;
try {
// Must use mw.message to avoid JSON being parsed as Wikitext
tools = JSON.parse( mw.message( 'visualeditor-cite-tool-definition.json' ).plain() );
} catch ( e ) {
tools = [];
}
// Go over available tools
for ( i = 0, len = Math.min( limit, tools.length ); i < len; i++ ) {
item = tools[ i ];
items.push( new OO.ui.DecoratedOptionWidget( {
icon: item.icon,
label: item.title,
data: {
windowName: 'cite-' + item.name,
dialogData: { template: item.template }
}
} ) );
}
// Basic tools
this.refBasic = new OO.ui.DecoratedOptionWidget( {
icon: 'reference',
label: ve.msg( 'visualeditor-dialogbutton-reference-full-label' ),
data: { windowName: 'reference' },
classes: [ 've-ui-mwReferenceSourceSelectWidget-basic' ]
} );
items.push( this.refBasic );
if ( config.showExisting ) {
this.refExisting = new OO.ui.DecoratedOptionWidget( {
icon: 'reference-existing',
label: ve.msg( 'visualeditor-dialog-reference-useexisting-full-label' ),
data: {
windowName: 'reference',
dialogData: { useExisting: true }
},
classes: [ 've-ui-mwReferenceSourceSelectWidget-reuse' ]
} );
items.push( this.refExisting );
}
this.addItems( items );
$( '<div>' )
.addClass( 've-ui-mwReferenceSourceSelectWidget-separator' )
.insertBefore( this.refBasic.$element );
// Initialization
this.$element.addClass( 've-ui-mwReferenceSourceSelectWidget' );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWReferenceSourceSelectWidget, OO.ui.SelectWidget );
/* Methods */
/**
* Get the basic reference option
*
* @return {OO.ui.OptionWidget} Basic reference option
*/
ve.ui.MWReferenceSourceSelectWidget.prototype.getRefBasic = function () {
return this.refBasic;
};
/**
* Get the existing reference option
*
* @return {OO.ui.OptionWidget} Existing reference option
*/
ve.ui.MWReferenceSourceSelectWidget.prototype.getRefExisting = function () {
return this.refExisting;
};