| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
ve.ui.MWTransclusionOutlineControlsWidget = function OoUiOutlineControlsWidget() { |
| 16 |
|
| 17 |
ve.ui.MWTransclusionOutlineControlsWidget.super.call( this ); |
| 18 |
|
| 19 |
|
| 20 |
OO.ui.mixin.GroupElement.call( this ); |
| 21 |
|
| 22 |
|
| 23 |
this.addTemplateButton = new OO.ui.ButtonWidget( { |
| 24 |
framed: false, |
| 25 |
icon: 'puzzle', |
| 26 |
title: ve.msg( 'visualeditor-dialog-transclusion-add-template-button' ) |
| 27 |
} ); |
| 28 |
this.addWikitextButton = new OO.ui.ButtonWidget( { |
| 29 |
framed: false, |
| 30 |
icon: 'wikiText', |
| 31 |
title: ve.msg( 'visualeditor-dialog-transclusion-add-wikitext' ) |
| 32 |
} ); |
| 33 |
this.upButton = new OO.ui.ButtonWidget( { |
| 34 |
framed: false, |
| 35 |
icon: 'upTriangle', |
| 36 |
title: OO.ui.msg( 'ooui-outline-control-move-up' ), |
| 37 |
disabled: true |
| 38 |
} ); |
| 39 |
this.downButton = new OO.ui.ButtonWidget( { |
| 40 |
framed: false, |
| 41 |
icon: 'downTriangle', |
| 42 |
title: OO.ui.msg( 'ooui-outline-control-move-down' ), |
| 43 |
disabled: true |
| 44 |
} ); |
| 45 |
this.removeButton = new OO.ui.ButtonWidget( { |
| 46 |
framed: false, |
| 47 |
icon: 'trash', |
| 48 |
title: OO.ui.msg( 'ooui-outline-control-remove' ), |
| 49 |
disabled: true |
| 50 |
} ); |
| 51 |
|
| 52 |
|
| 53 |
this.addTemplateButton.connect( this, { |
| 54 |
click: [ 'emit', 'addTemplate' ] |
| 55 |
} ); |
| 56 |
this.addWikitextButton.connect( this, { |
| 57 |
click: [ 'emit', 'addWikitext' ] |
| 58 |
} ); |
| 59 |
this.upButton.connect( this, { |
| 60 |
click: [ 'emit', 'move', -1 ] |
| 61 |
} ); |
| 62 |
this.downButton.connect( this, { |
| 63 |
click: [ 'emit', 'move', 1 ] |
| 64 |
} ); |
| 65 |
this.removeButton.connect( this, { |
| 66 |
click: [ 'emit', 'remove' ] |
| 67 |
} ); |
| 68 |
|
| 69 |
|
| 70 |
this.$element.addClass( 've-ui-mwTransclusionOutlineControlsWidget' ); |
| 71 |
this.$group.addClass( 've-ui-mwTransclusionOutlineControlsWidget-items' ) |
| 72 |
.append( |
| 73 |
this.addTemplateButton.$element, |
| 74 |
this.addWikitextButton.$element |
| 75 |
); |
| 76 |
const $movers = $( '<div>' ) |
| 77 |
.addClass( 've-ui-mwTransclusionOutlineControlsWidget-movers' ) |
| 78 |
.append( |
| 79 |
this.upButton.$element, |
| 80 |
this.downButton.$element, |
| 81 |
this.removeButton.$element |
| 82 |
); |
| 83 |
this.$element.append( this.$icon, this.$group, $movers ); |
| 84 |
}; |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
OO.inheritClass( ve.ui.MWTransclusionOutlineControlsWidget, OO.ui.Widget ); |
| 89 |
OO.mixinClass( ve.ui.MWTransclusionOutlineControlsWidget, OO.ui.mixin.GroupElement ); |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
ve.ui.MWTransclusionOutlineControlsWidget.prototype.setButtonsEnabled = function ( states ) { |
| 129 |
this.upButton.setDisabled( !states.canMoveUp ); |
| 130 |
this.downButton.setDisabled( !states.canMoveDown ); |
| 131 |
this.removeButton.setDisabled( !states.canBeDeleted ); |
| 132 |
}; |