| 1 |
( function () { |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
mw.echo.ui.ReadStateButtonSelectWidget = function MwEchoUiReadStateButtonSelectWidget( config ) { |
| 12 |
|
| 13 |
mw.echo.ui.ReadStateButtonSelectWidget.super.call( this, Object.assign( {}, config, { |
| 14 |
items: [ |
| 15 |
new OO.ui.ButtonOptionWidget( { |
| 16 |
data: 'all', |
| 17 |
label: mw.msg( 'notification-inbox-filter-all' ) |
| 18 |
} ), |
| 19 |
new OO.ui.ButtonOptionWidget( { |
| 20 |
data: 'read', |
| 21 |
label: mw.msg( 'notification-inbox-filter-read' ) |
| 22 |
} ), |
| 23 |
new OO.ui.ButtonOptionWidget( { |
| 24 |
data: 'unread', |
| 25 |
label: mw.msg( 'notification-inbox-filter-unread' ) |
| 26 |
} ) |
| 27 |
] |
| 28 |
} ) ); |
| 29 |
|
| 30 |
this.connect( this, { choose: 'onChoose' } ); |
| 31 |
|
| 32 |
this.$element |
| 33 |
.addClass( 'mw-echo-ui-readStateButtonSelectWidget' ); |
| 34 |
}; |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
OO.inheritClass( mw.echo.ui.ReadStateButtonSelectWidget, OO.ui.ButtonSelectWidget ); |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
mw.echo.ui.ReadStateButtonSelectWidget.prototype.onChoose = function ( item ) { |
| 56 |
const data = item && item.getData(); |
| 57 |
|
| 58 |
if ( data ) { |
| 59 |
this.emit( 'filter', data ); |
| 60 |
} |
| 61 |
}; |
| 62 |
}() ); |