if ( !mw.user.isAnon() ) {
this.saveQueryButton = new mw.rcfilters.ui.SaveFiltersPopupButtonWidget(
this.controller,
- this.queriesModel
+ this.queriesModel,
+ {
+ $overlay: this.$overlay
+ }
);
this.saveQueryButton.$element.on( 'mousedown', function ( e ) { e.stopPropagation(); } );
this.viewsSelectWidget = new OO.ui.ButtonSelectWidget( {
classes: [ 'mw-rcfilters-ui-filterTagMultiselectWidget-views-select-widget' ],
items: [
- new OO.ui.ButtonOptionWidget( {
- framed: false,
- data: '',
- disabled: true,
- classes: [ 'mw-rcfilters-ui-filterTagMultiselectWidget-views-select-widget-label' ],
- label: mw.msg( 'rcfilters-view-advanced-filters-label' )
- } ),
new OO.ui.ButtonOptionWidget( {
framed: false,
data: 'namespaces',
icon: 'article',
+ label: mw.msg( 'namespaces' ),
title: mw.msg( 'rcfilters-view-namespaces-tooltip' )
} ),
new OO.ui.ButtonOptionWidget( {
framed: false,
data: 'tags',
icon: 'tag',
+ label: mw.msg( 'tags-title' ),
title: mw.msg( 'rcfilters-view-tags-tooltip' )
} )
]
mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.onMenuToggle.call( this );
if ( isVisible ) {
+ this.focus();
+
mw.hook( 'RcFilters.popup.open' ).fire();
if ( !this.getMenu().getSelectedItem() ) {
setTimeout( function () { this.getMenu().scrollToTop(); }.bind( this ), 0 );
}
} else {
+ this.blur();
+
// Clear selection
this.selectTag( null );
this.input.$input.blur();
};
+ /**
+ * @inheritdoc
+ */
+ mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onMouseDown = function ( e ) {
+ if ( !this.isDisabled() && e.which === OO.ui.MouseButtons.LEFT ) {
+ this.menu.toggle();
+
+ return false;
+ }
+ };
+
/**
* @inheritdoc
*/
this.matchingQuery ? this.matchingQuery.getLabel() : ''
);
this.savedQueryTitle.toggle( !!this.matchingQuery );
- this.saveQueryButton.toggle( !this.matchingQuery );
+ this.saveQueryButton.setDisabled( !!this.matchingQuery );
+ this.saveQueryButton.setTitle( !this.matchingQuery ?
+ mw.msg( 'rcfilters-savedqueries-add-new-title' ) :
+ mw.msg( 'rcfilters-savedqueries-already-saved' ) );
if ( this.matchingQuery ) {
this.emphasize();
* Respond to click event on the reset button
*/
mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onResetButtonClick = function () {
- if ( this.model.areCurrentFiltersEmpty() ) {
+ if ( this.model.areVisibleFiltersEmpty() ) {
// Reset to default filters
this.controller.resetToDefaults();
} else {
*/
mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.reevaluateResetRestoreState = function () {
var defaultsAreEmpty = this.controller.areDefaultsEmpty(),
- currFiltersAreEmpty = this.model.areCurrentFiltersEmpty(),
+ currFiltersAreEmpty = this.model.areVisibleFiltersEmpty(),
hideResetButton = currFiltersAreEmpty && defaultsAreEmpty;
this.resetButton.setIcon(