From 73e3ed37178307c77d62fce4135f057abc8feb2d Mon Sep 17 00:00:00 2001 From: Moriel Schottlender Date: Mon, 7 Sep 2015 16:54:47 -0700 Subject: [PATCH] Add a tooltip to the notification badges Since the nojs "base" version uses the automatic title creation of the personal tools, the message keys were adjusted accordingly, and the old unified message was removed. Bug: T108190 Change-Id: I1f242f530aa68562aa4dc885156586c22c4df618 --- Hooks.php | 4 ++-- Resources.php | 2 ++ i18n/en.json | 3 ++- i18n/qqq.json | 3 ++- modules/ext.echo.init.js | 4 ++-- modules/nojs/mw.echo.badge.less | 8 ++++---- modules/ooui/mw.echo.ui.NotificationBadgeWidget.js | 2 +- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Hooks.php b/Hooks.php index 74ec0e2b8..956caf0f4 100644 --- a/Hooks.php +++ b/Hooks.php @@ -681,7 +681,7 @@ class EchoHooks { ); $insertUrls = array( - 'notifications_alert' => $alertLink, + 'notifications-alert' => $alertLink, ); if ( $notifUser->hasMessages() ) { @@ -692,7 +692,7 @@ class EchoHooks { 'class' => $msgLinkClasses, ); - $insertUrls['notifications_message'] = $msgLink; + $insertUrls['notifications-message'] = $msgLink; } $personal_urls = wfArrayInsertAfter( $personal_urls, $insertUrls, 'userpage' ); diff --git a/Resources.php b/Resources.php index fb54135a4..9063f3bf7 100644 --- a/Resources.php +++ b/Resources.php @@ -69,6 +69,8 @@ $wgResourceModules += array( 'echo-notification-alert-text-only', 'echo-notification-message-text-only', 'echo-email-batch-bullet', + 'tooltip-pt-notifications-alert', + 'tooltip-pt-notifications-message', 'mypreferences' ), 'targets' => array( 'desktop', 'mobile' ), diff --git a/i18n/en.json b/i18n/en.json index 0b87362c3..900d1acef 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -40,7 +40,8 @@ "echo-no-title": "[No page]", "echo-error-no-formatter": "No formatting defined for notification.", "notifications": "Notifications", - "tooltip-pt-notifications": "Your notifications", + "tooltip-pt-notifications-alert": "{{GENDER:|Your}} alerts", + "tooltip-pt-notifications-message": "{{GENDER:|Your}} messages", "echo-specialpage": "Notifications", "echo-anon": "To receive notifications, [$1 create an account] or [$2 log in].", "echo-none": "You have no notifications.", diff --git a/i18n/qqq.json b/i18n/qqq.json index c73cf1206..f4f693596 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -61,7 +61,8 @@ "echo-no-title": "Shown in place of a page title in a notification if the notification has no specified page title.", "echo-error-no-formatter": "Error message displayed when no formatting has been defined for a notification. In other words, the extension doesn't know how to properly display the notification.", "notifications": "{{doc-special|Notifications}}\n{{Identical|Notification}}", - "tooltip-pt-notifications": "This is used for the title (mouseover text) of the notifications user tool.", + "tooltip-pt-notifications-alert": "This is used for the title (mouseover text) of the alert notifications user tool.", + "tooltip-pt-notifications-message": "This is used for the title (mouseover text) of the message notifications user tool.", "echo-specialpage": "Special page title for Special:Notifications.\n{{Identical|Notification}}", "echo-anon": "Error message shown to users who try to visit [[Special:Notifications]] as an anon.\n\nParameters:\n* $1 - URL of signup page, with returnto pointing to Special:Notifications\n* $2 - URL of login page, with returnto pointing to Special:Notifications", "echo-none": "Message shown to users who have no notifications. Also shown in the overlay.", diff --git a/modules/ext.echo.init.js b/modules/ext.echo.init.js index 6251c6881..a8d3804ae 100644 --- a/modules/ext.echo.init.js +++ b/modules/ext.echo.init.js @@ -13,8 +13,8 @@ // Activate ooui $( document ).ready( function () { - var $existingAlertLink = $( '#pt-notifications_alert a' ), - $existingMessageLink = $( '#pt-notifications_message a' ), + var $existingAlertLink = $( '#pt-notifications-alert a' ), + $existingMessageLink = $( '#pt-notifications-message a' ), numAlerts = $existingAlertLink.text(), numMessages = $existingMessageLink.text(), hasUnseenAlerts = $existingAlertLink.hasClass( 'mw-echo-unseen-notifications' ), diff --git a/modules/nojs/mw.echo.badge.less b/modules/nojs/mw.echo.badge.less index a1a9f5866..3970c8432 100644 --- a/modules/nojs/mw.echo.badge.less +++ b/modules/nojs/mw.echo.badge.less @@ -3,8 +3,8 @@ /* We have to include the #pt-notifications selector due to monobook */ .mw-echo-notifications-badge { - #pt-notifications_alert &, - #pt-notifications_message & { + #pt-notifications-alert &, + #pt-notifications-message & { .mixin-notifications-badge(); display: inline-block; @@ -31,10 +31,10 @@ } &.mw-echo-unseen-notifications { - #pt-notifications_alert & { + #pt-notifications-alert & { background-color: @badge-background-unseen-alert; } - #pt-notifications_message & { + #pt-notifications-message & { background-color: @badge-background-unseen-message; } } diff --git a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js index 9731d9b29..3eb073f1f 100644 --- a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js +++ b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js @@ -82,12 +82,12 @@ allNotificationsButton.$element, preferencesButton.$element ); - // Parent constructor mw.echo.ui.NotificationBadgeWidget.parent.call( this, $.extend( { framed: false, flags: buttonFlags, label: this.numItems, + title: mw.msg( 'tooltip-pt-notifications-' + this.type ), popup: { $content: this.notificationsWidget.$element, $footer: $footer,