From 59a405083837cf44239d8017c5e2e44c2db5849d Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 21 Jun 2015 19:46:44 +0200 Subject: [PATCH] Only show "mark all as read" if min. one notification is available. --- .../controllers/widget/online_notification.js.coffee | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee index fb74bebce..971131515 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee @@ -40,7 +40,7 @@ class App.OnlineNotificationWidget extends App.Controller if !count @el.find('.js-counter').text('') return - + @el.find('.js-counter').text(count) markAllAsRead: => @@ -73,7 +73,7 @@ class App.OnlineNotificationWidget extends App.Controller notificationsContainer.addClass('is-overflowing') else notificationsContainer.removeClass('is-overflowing') - + notificationsContainer.find('.popover-content').css('height', "#{heightPopoverContentNew}px") # close notification list on click @@ -118,6 +118,12 @@ class App.OnlineNotificationWidget extends App.Controller App.i18n.translateInline( 'Notifications' ) + " #{counter}" ) + # show mark all as read if needed + if counter is 0 + $('.js-notificationsContainer .js-markAllAsRead').addClass('hidden') + else + $('.js-notificationsContainer .js-markAllAsRead').removeClass('hidden') + # update content items = @prepareForObjectList(items) $('.js-notificationsContainer .popover-content').html(