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

14 lines
384 B
Ruby
Raw Permalink Normal View History

2016-09-24 03:00:46 +00:00
# frozen_string_literal: true
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
def user_unread_notification_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