diff --git a/app/components/layout/notification_item_component.html.erb b/app/components/layout/notification_item_component.html.erb index 954b60420..2fbae2250 100644 --- a/app/components/layout/notification_item_component.html.erb +++ b/app/components/layout/notification_item_component.html.erb @@ -8,23 +8,12 @@ <% if user.notifications.unread.count > 0 %> - - - <%= t("layouts.header.notification_item.new_notifications", - count: user.notifications_count) %> - + <% else %> - - - <%= t("layouts.header.notification_item.no_notifications") %> - + <% end %> + <%= text %> <% end %> <% end %> diff --git a/app/components/layout/notification_item_component.rb b/app/components/layout/notification_item_component.rb index 62952be1c..37be31de1 100644 --- a/app/components/layout/notification_item_component.rb +++ b/app/components/layout/notification_item_component.rb @@ -4,4 +4,14 @@ class Layout::NotificationItemComponent < ApplicationComponent def initialize(user) @user = user end + + private + + def text + if user.notifications.unread.count > 0 + t("layouts.header.notification_item.new_notifications", count: user.notifications_count) + else + t("layouts.header.notification_item.no_notifications") + end + end end