Module: ApplicationNotificationsHelper

Included in:
ApplicationHelper, ConsolidatedOpeningReminderMailerHelper, Notifier::Base
Defined in:
app/helpers/application_notifications_helper.rb

Instance Method Summary collapse

Instance Method Details

#notification_directory_path(notification) ⇒ String

Returns the directory with the notification views.

Parameters:

Returns:

  • (String)

    The directory with the target notification's views


15
16
17
18
19
20
# File 'app/helpers/application_notifications_helper.rb', line 15

def notification_directory_path(notification)
  activity = notification.activity
  root_path = "notifiers/#{activity.notifier_type.underscore}/#{activity.event}"
  notification_class_name = notification.class.name.underscore.tr('/', '_').pluralize
  "/#{root_path}/#{notification_class_name}"
end

#notification_view_path(notification) ⇒ String

Returns the view path of the notification

Parameters:

Returns:

  • (String)

    The view path of the notification


7
8
9
# File 'app/helpers/application_notifications_helper.rb', line 7

def notification_view_path(notification)
  "#{notification_directory_path(notification)}/#{notification.notification_type}"
end