UX: Disable dismiss notifications button when there is nothing to dismiss.

This commit is contained in:
Guo Xiang Tan 2016-08-04 09:48:10 +08:00
parent 331135a88e
commit 927bf19d93
2 changed files with 7 additions and 1 deletions

View File

@ -14,6 +14,11 @@ export default Ember.ArrayController.extend({
return length > 0; return length > 0;
}, },
@computed('model.content.@each.read')
allNotificationsRead() {
return !this.get('model.content').some((notification) => !notification.get('read'));
},
currentPath: Em.computed.alias('controllers.application.currentPath'), currentPath: Em.computed.alias('controllers.application.currentPath'),
actions: { actions: {

View File

@ -23,7 +23,8 @@
class='btn dismiss-notifications' class='btn dismiss-notifications'
action="resetNew" action="resetNew"
label='user.dismiss_notifications' label='user.dismiss_notifications'
icon='check'}} icon='check'
disabled=allNotificationsRead}}
{{/if}} {{/if}}
</section> </section>