3 * Button for marking all changes as seen on the Watchlist
5 * @class mw.rcfilters.ui.MarkSeenButtonWidget
6 * @extends OO.ui.ButtonWidget
9 * @param {mw.rcfilters.Controller} controller
10 * @param {mw.rcfilters.dm.ChangesListViewModel} model Changes list view model
11 * @param {Object} [config] Configuration object
13 var MarkSeenButtonWidget
= function MwRcfiltersUiMarkSeenButtonWidget( controller
, model
, config
) {
14 config
= config
|| {};
17 MarkSeenButtonWidget
.parent
.call( this, $.extend( {
18 label
: mw
.message( 'rcfilters-watchlist-markseen-button' ).text(),
22 this.controller
= controller
;
26 this.connect( this, { click
: 'onClick' } );
27 this.model
.connect( this, { update
: 'onModelUpdate' } );
29 this.$element
.addClass( 'mw-rcfilters-ui-markSeenButtonWidget' );
36 OO
.inheritClass( MarkSeenButtonWidget
, OO
.ui
.ButtonWidget
);
41 * Respond to the button being clicked
43 MarkSeenButtonWidget
.prototype.onClick = function () {
44 this.controller
.markAllChangesAsSeen();
45 // assume there's no more unseen changes until the next model update
46 this.setDisabled( true );
50 * Respond to the model being updated with new changes
52 MarkSeenButtonWidget
.prototype.onModelUpdate = function () {
53 this.setDisabled( !this.model
.hasUnseenWatchedChanges() );
56 module
.exports
= MarkSeenButtonWidget
;