module Notifications::Helper

Public Instance Methods

notifications_count_for(origin, opts = {}) click to toggle source
# File lib/notifications/helper.rb, line 19
def notifications_count_for(origin, opts = {})
  content_tag (opts[:container] || :div), '',
    id:    'js-notifications-count',
    class: opts[:container_class]
end
notifications_for(destination, opts = {}) click to toggle source
# File lib/notifications/helper.rb, line 3
def notifications_for(destination, opts = {})
  opts = set_default_options(opts)

  content_tag opts[:container], '',
    id:    'js-notifications-container',
    class: opts[:container_class],
    data:  {
      firebase_project_id:          Notifications.configuration.firebase_project_id,
      firebase_api_key:             Notifications.configuration.firebase_api_key,
      destination:                  destination,
      notification_container:       opts[:notification_container],
      notification_container_class: opts[:notification_container_class],
      notification_class:           opts[:notification_class]
    }
end

Private Instance Methods

set_default_options(opts) click to toggle source
# File lib/notifications/helper.rb, line 27
def set_default_options(opts)
  opts[:container]                    ||= :div
  opts[:container_class]              ||= ''
  opts[:notification_container]       ||= :div
  opts[:notification_container_class] ||= ''
  opts[:notificaton_class]            ||= ''

  opts
end