mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-23 10:22:05 +00:00
Update Echo to use MobileFrontend IconButton.js
Bug: T340262 Depends-on: I186e3d22aa9c2b331a80d35514d578949a4b9e86 Change-Id: I415f5092df5b757576a67b612a7691e9038a696f
This commit is contained in:
parent
24d6ddcc1b
commit
d002532295
|
@ -1,9 +1,10 @@
|
|||
var
|
||||
mobile = mw.mobileFrontend.require( 'mobile.startup' ),
|
||||
View = mobile.View,
|
||||
Icon = mobile.Icon,
|
||||
notificationIcon = new Icon( {
|
||||
name: 'bellOutline-base20',
|
||||
IconButton = mobile.IconButton,
|
||||
notificationIconButton = new IconButton( {
|
||||
icon: 'bellOutline-base20',
|
||||
tagName: 'a',
|
||||
glyphPrefix: 'wikimedia'
|
||||
} );
|
||||
|
||||
|
@ -34,14 +35,15 @@ function NotificationBadge( options ) {
|
|||
options.hasUnseenNotifications = $el.find( '.notification-unseen' ).length > 0;
|
||||
options.hasNotifications = options.hasUnseenNotifications;
|
||||
$notificationAnchor = $el.find( 'a' );
|
||||
options.title = $notificationAnchor.attr( 'title' );
|
||||
options.title = $notificationAnchor.children().first().text();
|
||||
options.url = $notificationAnchor.attr( 'href' );
|
||||
count = Number( $el.find( '[data-notification-count]' ).data( 'notification-count' ) );
|
||||
}
|
||||
|
||||
View.call( this,
|
||||
$.extend( {
|
||||
notificationIconClass: notificationIcon.getClassName(),
|
||||
notificationButtonClass: notificationIconButton.getClassName(),
|
||||
notificationIconClass: notificationIconButton.getIcon().getClassName(),
|
||||
hasNotifications: false,
|
||||
hasUnseenNotifications: false,
|
||||
notificationCountRaw: 0
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{{^hasNotifications}}
|
||||
<a href="{{url}}" title="{{title}}"
|
||||
class="{{notificationIconClass}} mw-echo-notification-badge-nojs user-button" id="user-notifications" data-event-name="ui.notifications">
|
||||
{{title}}
|
||||
class="{{notificationButtonClass}} mw-echo-notification-badge-nojs user-button" id="user-notifications" data-event-name="ui.notifications">
|
||||
<span class="{{notificationIconClass}}"></span>
|
||||
<span>{{title}}</span>
|
||||
</a>
|
||||
{{/hasNotifications}}
|
||||
{{#hasNotifications}}
|
||||
|
|
Loading…
Reference in a new issue