blob: 46c9f2fbc1bcfea546dd062935c05c600e80c987 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/*!
* VisualEditor MWReferencesListContextItem class.
*
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
* @license MIT
*/
/**
* 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.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' ) )
);
}
};
/**
* @inheritdoc
*/
ve.ui.MWReferencesListContextItem.prototype.getDescription = function () {
var group = this.model.getAttribute( 'refGroup' );
return group ?
ve.msg( 'cite-ve-dialog-referenceslist-contextitem-description-named', group ) :
ve.msg( 'cite-ve-dialog-referenceslist-contextitem-description-general' );
};
/* Registration */
ve.ui.contextItemFactory.register( ve.ui.MWReferencesListContextItem );
|