Merge "Do not use fancy styled badge on Modern and CologneBlue"

This commit is contained in:
jenkins-bot 2017-04-03 18:37:23 +00:00 committed by Gerrit Code Review
commit d66341f83c
6 changed files with 42 additions and 31 deletions

View file

@ -193,6 +193,8 @@
"mediawiki.api.options" "mediawiki.api.options"
], ],
"messages": [ "messages": [
"echo-notification-notice",
"echo-notification-alert",
"echo-popup-footer-special-page-invitation", "echo-popup-footer-special-page-invitation",
"echo-popup-footer-special-page-invitation-link" "echo-popup-footer-special-page-invitation-link"
], ],
@ -405,19 +407,20 @@
}, },
"ext.echo.styles.badge": { "ext.echo.styles.badge": {
"position": "top", "position": "top",
"styles": [
"nojs/mw.echo.badge.less"
],
"skinStyles": { "skinStyles": {
"default": [
"nojs/mw.echo.badge.less"
],
"monobook": [ "monobook": [
"nojs/mw.echo.badge.less",
"nojs/mw.echo.badge.monobook.less" "nojs/mw.echo.badge.monobook.less"
], ],
"vector": [ "vector": [
"nojs/mw.echo.badge.less",
"nojs/mw.echo.badge.vector.less" "nojs/mw.echo.badge.vector.less"
], ],
"modern": [ "cologneblue": [],
"nojs/mw.echo.badge.modern.less" "modern": []
]
}, },
"targets": [ "targets": [
"desktop", "desktop",
@ -446,6 +449,9 @@
], ],
"modern": [ "modern": [
"nojs/mw.echo.alert.modern.less" "nojs/mw.echo.alert.modern.less"
],
"cologneblue": [
"nojs/mw.echo.alert.cologneblue.less"
] ]
}, },
"targets": [ "targets": [

View file

@ -0,0 +1,3 @@
#pt-mytalk a.mw-echo-alert {
padding: 0;
}

View file

@ -1,3 +1,9 @@
#pt-mytalk a.mw-echo-alert { #pt-mytalk a.mw-echo-alert {
border-radius: 0; border-radius: 0;
display: block;
height: 100%;
}
#pt-mytalk a.mw-echo-alert:hover {
background-color: #fab951;
} }

View file

@ -1,8 +0,0 @@
.mw-echo-notifications-badge {
#pt-notifications-alert &,
#pt-notifications-notice & {
&:before {
z-index: 0;
}
}
}

View file

@ -3,16 +3,15 @@ body #p-personal {
} }
#p-personal li.mw-echo-ui-notificationBadgeButtonPopupWidget { #p-personal li.mw-echo-ui-notificationBadgeButtonPopupWidget {
font-variant: normal; .mw-echo-ui-notificationBadgeButtonPopupWidget-popup {
text-transform: none; font-variant: normal;
font-weight: normal; text-transform: none;
// Badge font-weight: normal;
> .oo-ui-buttonElement-button {
border-radius: 0; // Popup buttons
} .oo-ui-buttonElement-button:hover {
// Popup buttons // In modern, the hover color is white, which is unhelpful.
.oo-ui-buttonElement-button:hover { color: #666;
// In modern, the hover color is white, which is unhelpful. }
color: #666;
} }
} }

View file

@ -24,7 +24,7 @@
*/ */
mw.echo.ui.NotificationBadgeWidget = function MwEchoUiNotificationBadgeButtonPopupWidget( controller, manager, config ) { mw.echo.ui.NotificationBadgeWidget = function MwEchoUiNotificationBadgeButtonPopupWidget( controller, manager, config ) {
var buttonFlags, allNotificationsButton, preferencesButton, footerButtonGroupWidget, $footer, var buttonFlags, allNotificationsButton, preferencesButton, footerButtonGroupWidget, $footer,
notice, adjustedTypeString; notice, adjustedTypeString, wrappedBadgeLabel;
config = config || {}; config = config || {};
config.links = config.links || {}; config.links = config.links || {};
@ -45,8 +45,6 @@
this.controller = controller; this.controller = controller;
this.manager = manager; this.manager = manager;
adjustedTypeString = this.controller.getTypeString() === 'message' ? 'notice' : this.controller.getTypeString();
// Properties // Properties
this.types = this.manager.getTypes(); this.types = this.manager.getTypes();
@ -58,9 +56,12 @@
if ( config.hasUnseen ) { if ( config.hasUnseen ) {
buttonFlags.push( 'unseen' ); buttonFlags.push( 'unseen' );
} }
adjustedTypeString = this.controller.getTypeString() === 'message' ? 'notice' : this.controller.getTypeString();
// Messages: echo-notification-notice, echo-notification-alert
wrappedBadgeLabel = mw.message( 'echo-notification-' + adjustedTypeString, this.badgeLabel ).text();
this.badgeButton = new mw.echo.ui.BadgeLinkWidget( { this.badgeButton = new mw.echo.ui.BadgeLinkWidget( {
label: this.badgeLabel, label: wrappedBadgeLabel,
type: this.manager.getTypeString(), type: this.manager.getTypeString(),
numItems: this.numItems, numItems: this.numItems,
flags: buttonFlags, flags: buttonFlags,
@ -265,14 +266,18 @@
* Update the badge state and label based on changes to the model * Update the badge state and label based on changes to the model
*/ */
mw.echo.ui.NotificationBadgeWidget.prototype.updateBadge = function () { mw.echo.ui.NotificationBadgeWidget.prototype.updateBadge = function () {
var unreadCount, cappedUnreadCount, badgeLabel; var unreadCount, cappedUnreadCount, badgeLabel, adjustedTypeString, wrappedBadgeLabel;
unreadCount = this.manager.getUnreadCounter().getCount(); unreadCount = this.manager.getUnreadCounter().getCount();
cappedUnreadCount = this.manager.getUnreadCounter().getCappedNotificationCount( unreadCount ); cappedUnreadCount = this.manager.getUnreadCounter().getCappedNotificationCount( unreadCount );
cappedUnreadCount = mw.language.convertNumber( cappedUnreadCount ); cappedUnreadCount = mw.language.convertNumber( cappedUnreadCount );
badgeLabel = mw.message( 'echo-badge-count', mw.language.convertNumber( cappedUnreadCount ) ).text(); badgeLabel = mw.message( 'echo-badge-count', mw.language.convertNumber( cappedUnreadCount ) ).text();
this.badgeButton.setLabel( badgeLabel ); adjustedTypeString = this.controller.getTypeString() === 'message' ? 'notice' : this.controller.getTypeString();
// Messages: echo-notification-notice, echo-notification-alert
wrappedBadgeLabel = mw.message( 'echo-notification-' + adjustedTypeString, badgeLabel ).text();
this.badgeButton.setLabel( wrappedBadgeLabel );
this.badgeButton.setCount( unreadCount, badgeLabel ); this.badgeButton.setCount( unreadCount, badgeLabel );
// Update seen state only if the counter is 0 // Update seen state only if the counter is 0
// so we don't run into inconsistencies and have an unseen state // so we don't run into inconsistencies and have an unseen state