Module: ActiveJob::Notificare::ViewHelpers

Defined in:
app/helpers/active_job/notificare/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#active_job_notificare(execution) ⇒ Object



4
5
6
# File 'app/helpers/active_job/notificare/view_helpers.rb', line 4

def active_job_notificare(execution)
  render partial: "active_job/notificare/progress", locals: { execution: execution }
end

#active_job_notifications(for: nil) ⇒ Object



8
9
10
11
12
# File 'app/helpers/active_job/notificare/view_helpers.rb', line 8

def active_job_notifications(for: nil)
  recipient = binding.local_variable_get(:for)
  notifications = Notification.where(recipient: recipient).visible
  render partial: "active_job/notificare/notifications", locals: { notifications: notifications, recipient: recipient }
end

#notificare_clear_notifications_pathObject



34
35
36
37
38
39
40
# File 'app/helpers/active_job/notificare/view_helpers.rb', line 34

def notificare_clear_notifications_path
  if respond_to?(:clear_notifications_path)
    clear_notifications_path
  else
    url_for(controller: "active_job/notificare/notifications", action: "clear", only_path: true)
  end
end

#notificare_dismiss_notification_path(notification) ⇒ Object



26
27
28
29
30
31
32
# File 'app/helpers/active_job/notificare/view_helpers.rb', line 26

def notificare_dismiss_notification_path(notification)
  if respond_to?(:dismiss_notification_path)
    dismiss_notification_path(notification)
  else
    url_for(controller: "active_job/notificare/notifications", action: "dismiss", id: notification.to_param, only_path: true)
  end
end

#notificare_read_notification_path(notification) ⇒ Object

In engine context (engine’s own controller views or tests with engine routes included), the bare route helpers like read_notification_path are defined on self. In host app views they are not, so we fall back to url_for with the full controller path, which the host app’s route set resolves to the correct mounted prefix.



18
19
20
21
22
23
24
# File 'app/helpers/active_job/notificare/view_helpers.rb', line 18

def notificare_read_notification_path(notification)
  if respond_to?(:read_notification_path)
    read_notification_path(notification)
  else
    url_for(controller: "active_job/notificare/notifications", action: "read", id: notification.to_param, only_path: true)
  end
end