Generates link to accept notifications.
# File app/helpers/notifications_helper.rb, line 41 def notification_accept_link(path) link_to 'Accept', path, method: 'patch', remote: true, class: 'accept-btn' end
Generate notification links for actions(i.e. redirect to tasks or events).
# File app/helpers/notifications_helper.rb, line 27 def notification_action_links(notification) links = "" case notification.key when 'group_event.create' links << notification_accept_link(accept_event_path(notification.trackable_id)) links << notification_reject_link(reject_event_path(notification.trackable_id)) when 'favorite.create' links << notification_accept_link(accept_user_favorites_path(notification.trackable_id)) links << notification_reject_link(reject_user_favorites_path(notification.trackable_id)) end links.html_safe end
Generates link to reject notifications.
# File app/helpers/notifications_helper.rb, line 46 def notification_reject_link(path) link_to 'Reject', path, method: 'patch', remote: true, class: 'reject-btn' end
Generates path for notification.
# File app/helpers/notifications_helper.rb, line 9 def path_for_notification(notification) if notification.owner.persisted? case notification.trackable_type when 'Invoice' invoices_path() when 'Event' personal_calendar_path() when 'ActsAsVotable::Vote' profile_path(notification.owner) when 'TutoringSession' dashboard_path() when 'ProfileVisit' profile_path(notification.owner) end end end
Returns unread notifications count.
# File app/helpers/notifications_helper.rb, line 4 def unread_notifications_count current_user.cached_notification_count end