Module: Elabs::NotificationHelper

Defined in:
app/helpers/elabs/notification_helper.rb

Instance Method Summary collapse

Instance Method Details

#notification_countObject



22
23
24
# File 'app/helpers/elabs/notification_helper.rb', line 22

def notification_count
  Elabs::Notification.for_user(current_user).count
end

#notification_icon(event) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/elabs/notification_helper.rb', line 11

def notification_icon(event)
  actions = {
    comment: 'comment',
    report:  'flag',
    lock:    'lock',
    unlock:  'unlock',
    delete:  'trash'
  }.freeze
  icon (actions[event.to_sym] || 'question'), ['fw']
end

#notification_message(notification) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/elabs/notification_helper.rb', line 3

def notification_message(notification)
  user   = notification_user notification.source_user
  action = notification_action notification.event
  link   = notification_link notification
  string = notification_string notification
  format(string, user: user, action: action, link: link).html_safe
end