3 * List displaying all filter groups
5 * @extends OO.ui.Widget
6 * @mixins OO.ui.mixin.PendingElement
9 * @param {mw.rcfilters.Controller} controller Controller
10 * @param {mw.rcfilters.dm.FiltersViewModel} model View model
11 * @param {mw.rcfilters.dm.SavedQueriesModel} savedQueriesModel Saved queries model
12 * @param {mw.rcfilters.dm.ChangesListViewModel} changesListModel
13 * @param {Object} [config] Configuration object
14 * @cfg {Object} [filters] A definition of the filter groups in this list
15 * @cfg {jQuery} [$overlay] A jQuery object serving as overlay for popups
16 * @cfg {jQuery} [$wrapper] A jQuery object for the wrapper of the general
17 * system. If not given, falls back to this widget's $element
18 * @cfg {boolean} [collapsed] Filter area is collapsed
20 mw
.rcfilters
.ui
.FilterWrapperWidget
= function MwRcfiltersUiFilterWrapperWidget(
21 controller
, model
, savedQueriesModel
, changesListModel
, config
24 config
= config
|| {};
27 mw
.rcfilters
.ui
.FilterWrapperWidget
.parent
.call( this, config
);
29 OO
.ui
.mixin
.PendingElement
.call( this, config
);
31 this.controller
= controller
;
33 this.queriesModel
= savedQueriesModel
;
34 this.changesListModel
= changesListModel
;
35 this.$overlay
= config
.$overlay
|| this.$element
;
36 this.$wrapper
= config
.$wrapper
|| this.$element
;
38 this.filterTagWidget
= new mw
.rcfilters
.ui
.FilterTagMultiselectWidget(
43 $overlay
: this.$overlay
,
44 collapsed
: config
.collapsed
,
45 $wrapper
: this.$wrapper
49 this.liveUpdateButton
= new mw
.rcfilters
.ui
.LiveUpdateButtonWidget(
54 this.numChangesAndDateWidget
= new mw
.rcfilters
.ui
.ChangesLimitAndDateButtonWidget(
58 $overlay
: this.$overlay
62 this.showNewChangesLink
= new OO
.ui
.ButtonWidget( {
65 label
: mw
.msg( 'rcfilters-show-new-changes' ),
66 flags
: [ 'progressive' ],
67 classes
: [ 'mw-rcfilters-ui-filterWrapperWidget-showNewChanges' ]
71 this.filterTagWidget
.menu
.connect( this, { toggle
: [ 'emit', 'menuToggle' ] } );
72 this.changesListModel
.connect( this, { newChangesExist
: 'onNewChangesExist' } );
73 this.showNewChangesLink
.connect( this, { click
: 'onShowNewChangesClick' } );
74 this.showNewChangesLink
.toggle( false );
77 this.$top
= $( '<div>' )
78 .addClass( 'mw-rcfilters-ui-filterWrapperWidget-top' );
80 $bottom
= $( '<div>' )
81 .addClass( 'mw-rcfilters-ui-filterWrapperWidget-bottom' )
83 this.showNewChangesLink
.$element
,
84 this.numChangesAndDateWidget
.$element
87 if ( mw
.config
.get( 'StructuredChangeFiltersLiveUpdatePollingRate' ) ) {
88 $bottom
.prepend( this.liveUpdateButton
.$element
);
92 .addClass( 'mw-rcfilters-ui-filterWrapperWidget' )
95 this.filterTagWidget
.$element
,
102 OO
.inheritClass( mw
.rcfilters
.ui
.FilterWrapperWidget
, OO
.ui
.Widget
);
103 OO
.mixinClass( mw
.rcfilters
.ui
.FilterWrapperWidget
, OO
.ui
.mixin
.PendingElement
);
108 * Set the content of the top section
110 * @param {jQuery} $topSectionElement
112 mw
.rcfilters
.ui
.FilterWrapperWidget
.prototype.setTopSection = function ( $topSectionElement
) {
113 this.$top
.append( $topSectionElement
);
117 * Respond to the user clicking the 'show new changes' button
119 mw
.rcfilters
.ui
.FilterWrapperWidget
.prototype.onShowNewChangesClick = function () {
120 this.controller
.showNewChanges();
124 * Respond to changes list model newChangesExist
126 * @param {boolean} newChangesExist Whether new changes exist
128 mw
.rcfilters
.ui
.FilterWrapperWidget
.prototype.onNewChangesExist = function ( newChangesExist
) {
129 this.showNewChangesLink
.toggle( newChangesExist
);