Sha256: c87e321768efc721c9c66b61cf8b89468728027c9760516745d4812615e70559

Contents?: true

Size: 658 Bytes

Versions: 21

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

module Decidim
  #
  # Decorator for push notifications.
  #
  class PushNotificationPresenter < SimpleDelegator
    def title
      event_class.constantize.model_name.human
    end

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

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

    def url
      event_class_instance.resource_url
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.28.4 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.27.9 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.29.0 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.28.3 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.27.8 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.29.0.rc4 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.29.0.rc3 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.29.0.rc2 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.29.0.rc1 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.28.2 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.27.7 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.28.1 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.27.6 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.28.0 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.27.5 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.28.0.rc5 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.28.0.rc4 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.27.4 app/presenters/decidim/push_notification_presenter.rb
decidim-core-0.27.3 app/presenters/decidim/push_notification_presenter.rb