Module: Eventifier::PathHelper

Defined in:
app/helpers/eventifier/path_helper.rb

Instance Method Summary collapse

Instance Method Details

#partial_path(notification, context = nil) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/helpers/eventifier/path_helper.rb', line 7

def partial_path notification, context = nil
  eventable_path = notification.event.eventable_type.underscore.gsub('/', '_')
  if lookup_context.exists?(eventable_path, [[:eventifier, context].compact.join("/")], true)
    [:eventifier, context, eventable_path].compact.join("/")
  else
    [:eventifier, context, 'notification'].compact.join("/")
  end
end

#render_partial_view(notification, context = nil) ⇒ Object



3
4
5
# File 'app/helpers/eventifier/path_helper.rb', line 3

def render_partial_view notification, context = nil
  render(partial: partial_path(notification, context), object: notification.event, locals: { notification: notification, event: notification.event, object: notification.event.eventable })
end