* @cfg {jQuery} [$overlay] A jQuery object serving as overlay for popups
*/
mw.rcfilters.ui.FilterWrapperWidget = function MwRcfiltersUiFilterWrapperWidget( controller, model, savedQueriesModel, config ) {
+ var $bottom;
config = config || {};
// Parent
{ $overlay: this.$overlay }
);
- this.namespaceButton = new OO.ui.ButtonWidget( {
- label: mw.msg( 'namespaces' ),
- icon: 'article',
- classes: [ 'mw-rcfilters-ui-filterWrapperWidget-namespaceToggle' ]
- } );
- this.namespaceButton.setActive( this.model.getCurrentView() === 'namespaces' );
-
- // Events
- this.model.connect( this, { update: 'onModelUpdate' } );
- this.namespaceButton.connect( this, { click: 'onNamespaceToggleClick' } );
+ this.liveUpdateButton = new mw.rcfilters.ui.LiveUpdateButtonWidget(
+ this.controller
+ );
// Initialize
this.$element
}
+ $bottom = $( '<div>' )
+ .addClass( 'mw-rcfilters-ui-filterWrapperWidget-bottom' );
+
+ if (
+ mw.config.get( 'wgStructuredChangeFiltersEnableLiveUpdate' ) ||
+ // Allow users to enable live update with ?liveupdate=1
+ new mw.Uri().query.liveupdate
+ ) {
+ $bottom.append( this.liveUpdateButton.$element );
+ }
+
this.$element.append(
this.filterTagWidget.$element,
- this.namespaceButton.$element
+ $bottom
);
- this.namespaceButton.toggle( !!mw.config.get( 'wgStructuredChangeFiltersEnableExperimentalViews' ) );
};
/* Initialization */
OO.inheritClass( mw.rcfilters.ui.FilterWrapperWidget, OO.ui.Widget );
OO.mixinClass( mw.rcfilters.ui.FilterWrapperWidget, OO.ui.mixin.PendingElement );
-
- /* Methods */
-
- /**
- * Respond to model update event
- */
- mw.rcfilters.ui.FilterWrapperWidget.prototype.onModelUpdate = function () {
- // Synchronize the state of the toggle button with the current view
- this.namespaceButton.setActive( this.model.getCurrentView() === 'namespaces' );
- };
-
- /**
- * Respond to namespace toggle button click
- */
- mw.rcfilters.ui.FilterWrapperWidget.prototype.onNamespaceToggleClick = function () {
- this.controller.switchView( 'namespaces' );
- this.filterTagWidget.focus();
- };
}( mediaWiki ) );