| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
ve.ui.EditCheckContextItem = function VeUiEditCheckContextItem() { |
| 19 |
|
| 20 |
ve.ui.EditCheckContextItem.super.apply( this, arguments ); |
| 21 |
|
| 22 |
|
| 23 |
this.$element.addClass( 've-ui-editCheckContextItem' ); |
| 24 |
}; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
OO.inheritClass( ve.ui.EditCheckContextItem, ve.ui.PersistentContextItem ); |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
ve.ui.EditCheckContextItem.static.name = 'editCheckReferences'; |
| 33 |
|
| 34 |
ve.ui.EditCheckContextItem.static.icon = 'quotes'; |
| 35 |
|
| 36 |
ve.ui.EditCheckContextItem.static.label = OO.ui.deferMsg( 'editcheck-dialog-addref-title' ); |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
ve.ui.EditCheckContextItem.prototype.renderBody = function () { |
| 44 |
const $actions = $( '<div>' ).addClass( 've-ui-editCheckContextItem-actions' ); |
| 45 |
|
| 46 |
this.data.action.getChoices().forEach( ( choice ) => { |
| 47 |
const button = new OO.ui.ButtonWidget( choice ); |
| 48 |
button.connect( this, { |
| 49 |
click: () => { |
| 50 |
this.onChoiceClick( choice.action ); |
| 51 |
} |
| 52 |
} ); |
| 53 |
$actions.append( button.$element ); |
| 54 |
} ); |
| 55 |
|
| 56 |
|
| 57 |
if ( this.context.isMobile() ) { |
| 58 |
this.context.closeButton.toggle( false ); |
| 59 |
} |
| 60 |
|
| 61 |
this.$body.append( |
| 62 |
$( '<p>' ).text( this.data.action.getDescription() ), |
| 63 |
$actions |
| 64 |
); |
| 65 |
}; |
| 66 |
|
| 67 |
ve.ui.EditCheckContextItem.prototype.close = function ( data ) { |
| 68 |
|
| 69 |
if ( this.context.isMobile() ) { |
| 70 |
this.context.closeButton.toggle( true ); |
| 71 |
} |
| 72 |
this.data.callback( data, this.data ); |
| 73 |
}; |
| 74 |
|
| 75 |
ve.ui.EditCheckContextItem.prototype.onChoiceClick = function ( choice ) { |
| 76 |
this.data.action.check.act( choice, this.data.action, this ); |
| 77 |
}; |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
ve.ui.contextItemFactory.register( ve.ui.EditCheckContextItem ); |