Sha256: 5b8d07d64cbe54e7e8fe786eaa62dc09f006d2e0f397a03cf9aef7b461c6ac3c

Contents?: true

Size: 581 Bytes

Versions: 5

Compression:

Stored size: 581 Bytes

Contents

module Mumuki::Laboratory::Controllers::Notifications
  def user_notifications_path
    "#{user_path}##{notifications_path}"
  end

  def has_notifications?
    notifications_count > 0
  end

  def notifications_count
    messages_count + discussions_count
  end

  private

  def notifications_path
    has_messages? ? 'messages' : 'discussions'
  end

  def has_messages?
    messages_count > 0
  end

  def messages_count
    current_user.try(:unread_messages).try(:count) || 0
  end

  def discussions_count
    current_user.try(:unread_discussions).try(:count) || 0
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mumuki-laboratory-5.7.0 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-5.6.3 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-5.6.2 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-5.6.1 lib/mumuki/laboratory/controllers/notifications.rb
mumuki-laboratory-5.6.0 lib/mumuki/laboratory/controllers/notifications.rb