Class: Decidim::PushNotificationPresenter

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/presenters/decidim/push_notification_presenter.rb

Overview

Decorator for push notifications.

Instance Method Summary collapse

Instance Method Details

#bodyObject



12
13
14
15
# File 'app/presenters/decidim/push_notification_presenter.rb', line 12

def body
  # Not using Rails sanitizers here because they escape HTML entities (i.e &) and we want to keep them
  Nokogiri::HTML(event_class_instance.notification_title).text if event_class_instance.notification_title.present?
end

#iconObject



17
18
19
# File 'app/presenters/decidim/push_notification_presenter.rb', line 17

def icon
  user.organization.attached_uploader(:favicon).variant_url(:big, host: user.organization.host)
end

#titleObject



8
9
10
# File 'app/presenters/decidim/push_notification_presenter.rb', line 8

def title
  event_class.constantize.model_name.human
end

#urlObject



21
22
23
# File 'app/presenters/decidim/push_notification_presenter.rb', line 21

def url
  event_class_instance.resource_url
end