2016-02-03 21:03:41 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor MWReferencesListContextItem class.
|
|
|
|
*
|
2018-01-03 01:05:45 +00:00
|
|
|
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
|
2017-12-29 12:12:35 +00:00
|
|
|
* @license MIT
|
2016-02-03 21:03:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Context item for a MWReferencesList.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.LinearContextItem
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {ve.ui.Context} context Context item is in
|
|
|
|
* @param {ve.dm.Model} model Model item is related to
|
2021-12-29 17:22:08 +00:00
|
|
|
* @param {Object} [config]
|
2016-02-03 21:03:41 +00:00
|
|
|
*/
|
|
|
|
ve.ui.MWReferencesListContextItem = function VeUiMWReferencesListContextItem() {
|
|
|
|
// Parent constructor
|
|
|
|
ve.ui.MWReferencesListContextItem.super.apply( this, arguments );
|
|
|
|
|
|
|
|
// Initialization
|
|
|
|
this.$element.addClass( 've-ui-mwReferencesListContextItem' );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.ui.MWReferencesListContextItem, ve.ui.LinearContextItem );
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.ui.MWReferencesListContextItem.static.name = 'referencesList';
|
|
|
|
|
|
|
|
ve.ui.MWReferencesListContextItem.static.icon = 'references';
|
|
|
|
|
|
|
|
ve.ui.MWReferencesListContextItem.static.label =
|
|
|
|
OO.ui.deferMsg( 'cite-ve-dialogbutton-referenceslist-tooltip' );
|
|
|
|
|
|
|
|
ve.ui.MWReferencesListContextItem.static.modelClasses = [ ve.dm.MWReferencesListNode ];
|
|
|
|
|
|
|
|
ve.ui.MWReferencesListContextItem.static.commandName = 'referencesList';
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
2018-02-06 20:14:40 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWReferencesListContextItem.prototype.renderBody = function () {
|
|
|
|
this.$body.append(
|
|
|
|
$( '<div>' ).text( this.getDescription() )
|
|
|
|
);
|
|
|
|
if ( this.model.getAttribute( 'templateGenerated' ) ) {
|
|
|
|
this.$body.append(
|
|
|
|
$( '<div>' )
|
|
|
|
.addClass( 've-ui-mwReferenceContextItem-muted' )
|
|
|
|
.text( ve.msg( 'cite-ve-referenceslist-missingreflist' ) )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-02-03 21:03:41 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWReferencesListContextItem.prototype.getDescription = function () {
|
|
|
|
var group = this.model.getAttribute( 'refGroup' );
|
|
|
|
|
|
|
|
return group ?
|
2016-02-10 00:32:18 +00:00
|
|
|
ve.msg( 'cite-ve-dialog-referenceslist-contextitem-description-named', group ) :
|
|
|
|
ve.msg( 'cite-ve-dialog-referenceslist-contextitem-description-general' );
|
2016-02-03 21:03:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ui.contextItemFactory.register( ve.ui.MWReferencesListContextItem );
|