mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 21:40:39 +03:00
Add a notify action to the notifications component
Refs #3160 - gh-notifications component now takes an optional notify parameter. If present it will be invoked as an action when a notification is added or removed. - Add a data-notification-count attribute to the main container that tracks the number of "top" notification messages that are currently being shown.
This commit is contained in:
parent
1181c18f20
commit
73be0780b9
@ -14,7 +14,11 @@ var NotificationsComponent = Ember.Component.extend({
|
||||
notification.get('location') : notification.location;
|
||||
|
||||
return this.get('location') === displayLocation;
|
||||
})
|
||||
}),
|
||||
|
||||
messageCountObserver: function () {
|
||||
this.sendAction('notify', this.get('messages').length);
|
||||
}.observes('messages.[]')
|
||||
});
|
||||
|
||||
export default NotificationsComponent;
|
||||
export default NotificationsComponent;
|
||||
|
@ -1,11 +1,17 @@
|
||||
var ApplicationController = Ember.Controller.extend({
|
||||
hideNav: Ember.computed.match('currentPath', /(signin|signup|setup|forgotten|reset)/),
|
||||
|
||||
topNotificationCount: 0,
|
||||
|
||||
actions: {
|
||||
toggleMenu: function () {
|
||||
this.toggleProperty('showMenu');
|
||||
},
|
||||
|
||||
topNotificationChange: function (count) {
|
||||
this.set('topNotificationCount', count);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default ApplicationController;
|
||||
export default ApplicationController;
|
||||
|
@ -2,8 +2,8 @@
|
||||
{{partial "navbar"}}
|
||||
{{/unless}}
|
||||
|
||||
<main role="main" id="main">
|
||||
{{gh-notifications location="top"}}
|
||||
<main role="main" id="main" {{bind-attr data-notification-count=topNotificationCount}}>
|
||||
{{gh-notifications location="top" notify="topNotificationChange"}}
|
||||
{{gh-notifications location="bottom"}}
|
||||
|
||||
{{outlet}}
|
||||
|
Loading…
Reference in New Issue
Block a user