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

15 lines
385 B
Ruby
Raw Normal View History

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