From: Stephane Bisson Date: Wed, 2 Aug 2017 19:15:03 +0000 (-0400) Subject: RCFilters: set live update button title X-Git-Tag: 1.31.0-rc.0~2496^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22brouteur%22%2C%28%24id_rubrique%20?a=commitdiff_plain;h=e3460a6666cd5b6302d0e646eb34846bf24eb11c;p=lhc%2Fweb%2Fwiklou.git RCFilters: set live update button title Bug: T167743 Change-Id: Iefea4001371921753e0622c195810b080c459968 --- diff --git a/languages/i18n/en.json b/languages/i18n/en.json index e540856336..497c87b1ae 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1459,6 +1459,8 @@ "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 $3, $4 (up to $1 shown).", "rclistfromreset": "Reset date selection", "rclistfrom": "Show new changes starting from $2, $3", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index abbefcb411..f3e25071ed 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1649,6 +1649,8 @@ "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}}.", diff --git a/resources/Resources.php b/resources/Resources.php index 1663b50b87..d8ab7d7a45 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -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', diff --git a/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.LiveUpdateButtonWidget.js b/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.LiveUpdateButtonWidget.js index 67c113d751..0fb3cb77c0 100644 --- a/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.LiveUpdateButtonWidget.js +++ b/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.LiveUpdateButtonWidget.js @@ -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 */ @@ -42,13 +43,27 @@ }; /** - * 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 ) );