app/controllers/tramway/admin/application_controller.rb in tramway-admin-1.18.4.4 vs app/controllers/tramway/admin/application_controller.rb in tramway-admin-1.19

- old
+ new

@@ -10,10 +10,12 @@ before_action :authenticate_admin! before_action :check_available! before_action :collections_counts, if: :model_given? before_action :check_available_scope!, if: :model_given?, only: :index before_action :application + before_action :notifications + before_action :notifications_count protect_from_forgery with: :exception protected @@ -34,9 +36,20 @@ end def application if ::Tramway::Core.application @application = Tramway::Core.application&.model_class&.first || Tramway::Core.application + end + end + + def notifications + @notifications ||= Tramway::Admin.notifications + @notifications + end + + def notifications_count + @notifications_count = notifications.reduce(0) do |count, notification| + count += notification[1].count end end if Rails.env.production? rescue_from StandardError do |exception|