mediawiki-extensions-Cite/modules/ve-cite/ve.ui.MWReferencesListContextItem.js
Ed Sanders 18f616b9b8 VisualEditor: Move code for Cite into this repo
This code has been developed over three years now in the repo of MediaWiki's
integration of VisualEditor. It has grown and developed significantly during
that time, but now is pretty stable. A number of hacks inside the MediaWiki-
VisualEditor code base have been used to prevent this code from being loaded
on wikis where the Cite extension is not deployed, but this state of affairs
is and always was meant to be temporary.

This code is under the MIT licence which is a tad messy, but not impossible.
It's clearly labelled as such. The list of authors has been updated to take
into account the influx of new functionality.

Bug: T41621
Bug: T104928
Change-Id: I39936ed83d5a60471a0a75da753f498e80aef234
2016-02-04 08:41:54 -08:00

59 lines
1.6 KiB
JavaScript

/*!
* VisualEditor MWReferencesListContextItem class.
*
* @copyright 2011-2016 VisualEditor Team and others; see http://ve.mit-license.org
*/
/**
* 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
* @param {Object} config Configuration options
*/
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 */
/**
* @inheritdoc
*/
ve.ui.MWReferencesListContextItem.prototype.getDescription = function () {
var group = this.model.getAttribute( 'refGroup' );
return group ?
ve.msg( 'visualeditor-dialog-referenceslist-contextitem-description-named', group ) :
ve.msg( 'visualeditor-dialog-referenceslist-contextitem-description-general' );
};
/* Registration */
ve.ui.contextItemFactory.register( ve.ui.MWReferencesListContextItem );