module UserNotif::ViewHelpers
Public Instance Methods
list_user_notifs(notifs = nil, small = true)
click to toggle source
# File lib/user_notif/view_helpers.rb, line 6 def list_user_notifs(notifs = nil, small = true) return unless notifs output = '' notifs.each { |n| output << user_notif(n, small) } wrap output end
notif_badge(notifs = nil)
click to toggle source
# File lib/user_notif/view_helpers.rb, line 21 def notif_badge(notifs = nil) nb = notifs.count nb == 0 ? '' : "<span class=\"notif-badge\">#{nb}</span>".html_safe end
user_notif(notif, small = true)
click to toggle source
# File lib/user_notif/view_helpers.rb, line 15 def user_notif(notif, small = true) @notif = notif @target = notif.target render("notifs/#{small ? 'small' : 'full'}/#{notif.template_name}") end
Private Instance Methods
wrap(elem)
click to toggle source
# File lib/user_notif/view_helpers.rb, line 28 def wrap(elem) "<div class=\"user-notif-wrapper\">#{elem}</div>".html_safe end