2023-08-21 08:08:23 +00:00
|
|
|
'use strict';
|
|
|
|
|
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
|
2023-07-10 13:33:24 +00:00
|
|
|
* @param {ve.ui.LinearContext} context Context the item is in
|
|
|
|
* @param {ve.dm.Model} model Model the 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';
|
|
|
|
|
2023-03-27 17:05:21 +00:00
|
|
|
ve.ui.MWReferencesListContextItem.static.embeddable = false;
|
|
|
|
|
2016-02-03 21:03:41 +00:00
|
|
|
/* 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 () {
|
2023-08-21 08:08:23 +00:00
|
|
|
const group = this.model.getAttribute( 'refGroup' );
|
2016-02-03 21:03:41 +00:00
|
|
|
|
|
|
|
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 );
|