metamaps--metamaps/app/helpers/application_helper.rb

15 lines
386 B
Ruby
Raw Normal View History

2016-09-24 03:00:46 +00:00
# frozen_string_literal: true
2017-11-25 19:23:47 +00:00
2016-03-25 04:26:07 +00:00
module ApplicationHelper
2016-09-24 04:27:34 +00:00
def invite_link
"#{request.base_url}/join" + (current_user ? "?code=#{current_user.code}" : '')
2016-03-25 04:26:07 +00:00
end
2018-03-08 14:47:15 +00:00
def user_unread_notifications_count
return 0 if current_user.nil?
2016-12-11 22:29:48 +00:00
@uunc ||= current_user.mailboxer_notification_receipts.reduce(0) do |total, receipt|
receipt.is_read ? total : total + 1
end
end
2012-09-23 02:39:12 +00:00
end