RCFilters: set live update button title
authorStephane Bisson <sbisson@wikimedia.org>
Wed, 2 Aug 2017 19:15:03 +0000 (15:15 -0400)
committerStephane Bisson <sbisson@wikimedia.org>
Wed, 2 Aug 2017 19:15:03 +0000 (15:15 -0400)
Bug: T167743
Change-Id: Iefea4001371921753e0622c195810b080c459968

languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.LiveUpdateButtonWidget.js

index e540856..497c87b 100644 (file)
        "rcfilters-view-tags-tooltip": "Filter results using edit tags",
        "rcfilters-view-return-to-default-tooltip": "Return to main filter menu",
        "rcfilters-liveupdates-button": "Live updates",
+       "rcfilters-liveupdates-button-title-on": "Turn off live updates",
+       "rcfilters-liveupdates-button-title-off": "Display new changes as they happen",
        "rcnotefrom": "Below {{PLURAL:$5|is the change|are the changes}} since <strong>$3, $4</strong> (up to <strong>$1</strong> shown).",
        "rclistfromreset": "Reset date selection",
        "rclistfrom": "Show new changes starting from $2, $3",
index abbefcb..f3e2507 100644 (file)
        "rcfilters-view-tags-tooltip": "Tooltip for the button that loads the tags view in [[Special:RecentChanges]]",
        "rcfilters-view-return-to-default-tooltip": "Tooltip for the button that returns to the default filter view in [[Special:RecentChanges]]",
        "rcfilters-liveupdates-button": "Label for the button to enable or disable live updates on [[Special:RecentChanges]]",
+       "rcfilters-liveupdates-button-title-on": "Title for the button to enable or disable live updates on [[Special:RecentChanges]] when the feature is ON.",
+       "rcfilters-liveupdates-button-title-off": "Title for the button to enable or disable live updates on [[Special:RecentChanges]] when the feature is OFF.",
        "rcnotefrom": "This message is displayed at [[Special:RecentChanges]] when viewing recentchanges from some specific time.\n\nThe corresponding message is {{msg-mw|Rclistfrom}}.\n\nParameters:\n* $1 - the maximum number of changes that are displayed\n* $2 - (Optional) a date and time\n* $3 - a date\n* $4 - a time\n* $5 - Number of changes are displayed, for use with PLURAL",
        "rclistfromreset": "Used on [[Special:RecentChanges]] to reset a selection of a certain date range.",
        "rclistfrom": "Used on [[Special:RecentChanges]]. Parameters:\n* $1 - (Currently not use) date and time. The date and the time adds to the rclistfrom description.\n* $2 - time. The time adds to the rclistfrom link description (with split of date and time).\n* $3 - date. The date adds to the rclistfrom link description (with split of date and time).\n\nThe corresponding message is {{msg-mw|Rcnotefrom}}.",
index 1663b50..d8ab7d7 100644 (file)
@@ -1887,6 +1887,8 @@ return [
                        'rcfilters-view-tags-tooltip',
                        'rcfilters-view-return-to-default-tooltip',
                        'rcfilters-liveupdates-button',
+                       'rcfilters-liveupdates-button-title-on',
+                       'rcfilters-liveupdates-button-title-off',
                        'rcfilters-other-review-tools',
                        'blanknamespace',
                        'namespaces',
index 67c113d..0fb3cb7 100644 (file)
@@ -14,7 +14,6 @@
 
                // Parent
                mw.rcfilters.ui.LiveUpdateButtonWidget.parent.call( this, $.extend( {
-                       icon: 'play',
                        label: mw.message( 'rcfilters-liveupdates-button' ).text()
                }, config ) );
 
@@ -26,6 +25,8 @@
                this.model.connect( this, { liveUpdateChange: 'onLiveUpdateChange' } );
 
                this.$element.addClass( 'mw-rcfilters-ui-liveUpdateButtonWidget' );
+
+               this.setState( false );
        };
 
        /* Initialization */
        };
 
        /**
-        * Respond to the 'live update' feature being turned on/off
+        * Set the button's state and change its appearance
         *
         * @param {boolean} enable Whether the 'live update' feature is now on/off
         */
-       mw.rcfilters.ui.LiveUpdateButtonWidget.prototype.onLiveUpdateChange = function ( enable ) {
+       mw.rcfilters.ui.LiveUpdateButtonWidget.prototype.setState = function ( enable ) {
                this.setValue( enable );
                this.setIcon( enable ? 'stop' : 'play' );
+               this.setTitle( mw.message(
+                       enable ?
+                               'rcfilters-liveupdates-button-title-on' :
+                               'rcfilters-liveupdates-button-title-off'
+               ).text() );
+       };
+
+       /**
+        * Respond to the 'live update' feature being turned on/off
+        *
+        * @param {boolean} enable Whether the 'live update' feature is now on/off
+        */
+       mw.rcfilters.ui.LiveUpdateButtonWidget.prototype.onLiveUpdateChange = function ( enable ) {
+               this.setState( enable );
        };
 
 }( mediaWiki ) );