3 * Button for marking all changes as seen on the Watchlist
5 * @extends OO.ui.ButtonWidget
8 * @param {mw.rcfilters.Controller} controller
9 * @param {mw.rcfilters.dm.ChangesListViewModel} model Changes list view model
10 * @param {Object} [config] Configuration object
12 mw
.rcfilters
.ui
.MarkSeenButtonWidget
= function MwRcfiltersUiMarkSeenButtonWidget( controller
, model
, config
) {
13 config
= config
|| {};
16 mw
.rcfilters
.ui
.MarkSeenButtonWidget
.parent
.call( this, $.extend( {
17 label
: mw
.message( 'rcfilters-watchlist-markseen-button' ).text(),
21 this.controller
= controller
;
25 this.connect( this, { click
: 'onClick' } );
26 this.model
.connect( this, { update
: 'onModelUpdate' } );
28 this.$element
.addClass( 'mw-rcfilters-ui-markSeenButtonWidget' );
35 OO
.inheritClass( mw
.rcfilters
.ui
.MarkSeenButtonWidget
, OO
.ui
.ButtonWidget
);
40 * Respond to the button being clicked
42 mw
.rcfilters
.ui
.MarkSeenButtonWidget
.prototype.onClick = function () {
43 this.controller
.markAllChangesAsSeen();
44 // assume there's no more unseen changes until the next model update
45 this.setDisabled( true );
49 * Respond to the model being updated with new changes
51 mw
.rcfilters
.ui
.MarkSeenButtonWidget
.prototype.onModelUpdate = function () {
52 this.setDisabled( !this.model
.hasUnseenWatchedChanges() );