Merge "RCFilters: Add title attribute to highlighted rows"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 21 Aug 2017 15:29:46 +0000 (15:29 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 21 Aug 2017 15:29:46 +0000 (15:29 +0000)
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.ChangesListWrapperWidget.js

index 6126bbd..b5cc6a5 100644 (file)
        "rcfilters-hours-title": "Recent hours",
        "rcfilters-days-show-days": "$1 {{PLURAL:$1|day|days}}",
        "rcfilters-days-show-hours": "$1 {{PLURAL:$1|hour|hours}}",
+       "rcfilters-highlighted-filters-list": "Highlighted: $1",
        "rcfilters-quickfilters": "Saved filters",
        "rcfilters-quickfilters-placeholder-title": "No links saved yet",
        "rcfilters-quickfilters-placeholder-description": "To save your filter settings and reuse them later, click the bookmark icon in the Active Filter area, below.",
index bc0fe2c..25517b9 100644 (file)
        "rcfilters-hours-title": "Title for the options to change the number of hours for the results shown.",
        "rcfilters-days-show-days": "Title for the button that opens the operation to control the day range for the results. \n\nParameters: $1 - Number of days shown",
        "rcfilters-days-show-hours": "Title for the button that opens the operation to control the hour range for the results. \n\nParameters: $1 - Number of hours shown",
+       "rcfilters-highlighted-filters-list": "Text for the tooltip that is displayed over highlighted results, specifying which filters the result matches in [[Special:RecentChanges]] when RCFilters are enabled. \n\nParameters: $1 - A comma separated list of matching filter names.",
        "rcfilters-quickfilters": "Label for the button that opens the saved filter settings menu in [[Special:RecentChanges]]",
        "rcfilters-quickfilters-placeholder-title": "Title for the text shown in the quick filters menu on [[Special:RecentChanges]] if the user has not saved any quick filters.",
        "rcfilters-quickfilters-placeholder-description": "Description for the text shown in the quick filters menu on [[Special:RecentChanges]] if the user has not saved any quick filters.",
index c0c5d9e..0216471 100644 (file)
@@ -1842,6 +1842,7 @@ return [
                        'rcfilters-hours-title',
                        'rcfilters-days-show-days',
                        'rcfilters-days-show-hours',
+                       'rcfilters-highlighted-filters-list',
                        'rcfilters-quickfilters',
                        'rcfilters-quickfilters-placeholder-title',
                        'rcfilters-quickfilters-placeholder-description',
index 28a80cc..955e01d 100644 (file)
                }
 
                this.filtersViewModel.getHighlightedItems().forEach( function ( filterItem ) {
+                       var $elements = this.$element.find( '.' + filterItem.getCssClass() );
+
                        // Add highlight class to all highlighted list items
-                       this.$element.find( '.' + filterItem.getCssClass() )
+                       $elements
                                .addClass( 'mw-rcfilters-highlight-color-' + filterItem.getHighlightColor() );
+
+                       $elements.each( function () {
+                               var filterString = $( this ).attr( 'data-highlightedFilters' ) || '',
+                                       filters = filterString ? filterString.split( '|' ) : [];
+
+                               if ( filters.indexOf( filterItem.getLabel() ) === -1 ) {
+                                       filters.push( filterItem.getLabel() );
+                               }
+
+                               $( this )
+                                       .attr( 'data-highlightedFilters', filters.join( '|' ) );
+                       } );
                }.bind( this ) );
+               // Apply a title for relevant filters
+               this.$element.find( '[data-highlightedFilters]' ).each( function () {
+                       var filterString = $( this ).attr( 'data-highlightedFilters' ) || '',
+                               filters = filterString ? filterString.split( '|' ) : [];
+
+                       if ( filterString ) {
+                               $( this ).attr( 'title', mw.msg( 'rcfilters-highlighted-filters-list', filters.join( ', ' ) ) );
+                       }
+               } );
 
                // Turn on highlights
                this.$element.addClass( 'mw-rcfilters-ui-changesListWrapperWidget-highlighted' );
                        this.$element.find( '.mw-rcfilters-highlight-color-' + color ).removeClass( 'mw-rcfilters-highlight-color-' + color );
                }.bind( this ) );
 
+               this.$element.find( '[data-highlightedFilters]' )
+                       .removeAttr( 'title' )
+                       .removeAttr( 'data-highlightedFilters' );
                // Turn off highlights
                this.$element.removeClass( 'mw-rcfilters-ui-changesListWrapperWidget-highlighted' );
        };