Mooeypoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/238017

Change subject: [wip] Get the button out of the <div> widget
......................................................................

[wip] Get the button out of the <div> widget

The button should remain a <a> element so it can be styled exactly
the same as the php version we're getting from the server. Get the
button out of the div widget, and adjust the popup location accordingly.

Also, this will allow us to use one unified stylesheet for the button
for both nojs and js versions.

Bug: T112218
Change-Id: Ib6fd4369d46cb7f37b14675d63bbce9950abcd48
---
M modules/ext.echo.init.js
M modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
M modules/ooui/styles/mw.echo.ui.NotificationBadgeWidget.less
3 files changed, 17 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/17/238017/1

diff --git a/modules/ext.echo.init.js b/modules/ext.echo.init.js
index 458de4e..6801211 100644
--- a/modules/ext.echo.init.js
+++ b/modules/ext.echo.init.js
@@ -32,7 +32,8 @@
                                numItems: numMessages,
                                hasUnseen: hasUnseenMessages,
                                badgeIcon: 'speechBubble',
-                               links: links
+                               links: links,
+                               $parent: $( '#pt-notifications-message' )
                        } );
                        // avoid late debouncedUpdateThemeClasses
                        mw.echo.ui.messageWidget.debouncedUpdateThemeClasses();
@@ -48,7 +49,8 @@
                                seen: 'bell',
                                unseen: 'bellOn'
                        },
-                       links: links
+                       links: links,
+                       $parent: $( '#pt-notifications-alert' )
                } );
 
                // avoid late debouncedUpdateThemeClasses
diff --git a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js 
b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
index 17534d6..6635f08 100644
--- a/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
+++ b/modules/ooui/mw.echo.ui.NotificationBadgeWidget.js
@@ -22,7 +22,8 @@
         *  } }
         */
        mw.echo.ui.NotificationBadgeWidget = function 
MwEchoUiNotificationBadgeButtonPopupWidget( config ) {
-               var buttonFlags, allNotificationsButton, preferencesButton, 
footerButtonGroupWidget, $footer;
+               var buttonFlags, allNotificationsButton, preferencesButton, 
footerButtonGroupWidget,
+                       $footer;
 
                config = config || {};
                config.links = config.links || {};
@@ -139,6 +140,17 @@
                                'mw-echo-ui-notificationBadgeButtonPopupWidget 
' +
                                
'mw-echo-ui-notificationBadgeButtonPopupWidget-' + this.type
                        );
+
+               // HACK: Since personal tools does not allow for an ooui widget 
on the
+               // php side, we have to work with <a> elements to make both 
nojs and js
+               // versions look exactly the same.
+               // Get the button outside the div of the widget.
+               if ( config.$parent ) {
+                       config.$parent.prepend(
+                               this.$button
+                                       .addClass( 
'mw-echo-notifications-badge' )
+                       );
+               }
        };
 
        /* Initialization */
diff --git a/modules/ooui/styles/mw.echo.ui.NotificationBadgeWidget.less 
b/modules/ooui/styles/mw.echo.ui.NotificationBadgeWidget.less
index a4d570b..cd0fdfd 100644
--- a/modules/ooui/styles/mw.echo.ui.NotificationBadgeWidget.less
+++ b/modules/ooui/styles/mw.echo.ui.NotificationBadgeWidget.less
@@ -2,20 +2,6 @@
 @import '../../echo.variables';
 
 .mw-echo-ui-notificationBadgeButtonPopupWidget {
-       &-alert {
-               // Must be strong to override OOUI's button background color 
definition
-               &.oo-ui-flaggedElement-unseen > .oo-ui-buttonElement-button {
-                       background-color: @badge-background-unseen-alert;
-               }
-       }
-       &-message {
-               margin-left: @badge-distance-adjustment;
-               // Must be strong to override OOUI's button background color 
definition
-               &.oo-ui-flaggedElement-unseen > .oo-ui-buttonElement-button {
-                       background-color: @badge-background-unseen-message;
-               }
-       }
-
        .oo-ui-popupWidget-footer {
                border-top: 1px solid #DDDDDD;
                width: 100%;

-- 
To view, visit https://gerrit.wikimedia.org/r/238017
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6fd4369d46cb7f37b14675d63bbce9950abcd48
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to