Class: Decidim::NotificationToMailerPresenter

Inherits:
SimpleDelegator
  • Object
show all
Includes:
TranslatableAttributes
Defined in:
decidim-core/app/presenters/decidim/notification_to_mailer_presenter.rb

Overview

Decorator for notifications in mail digest

Constant Summary collapse

EXTENDED_NOTIFICATIONS_CLASSES =
[
  "Decidim::Comments::CommentCreatedEvent"
].freeze

Instance Method Summary collapse

Methods included from TranslatableAttributes

#attachment?, #default_locale?

Instance Method Details

#date_timeObject



24
25
26
27
28
29
30
31
# File 'decidim-core/app/presenters/decidim/notification_to_mailer_presenter.rb', line 24

def date_time
  created_at_in_time_zone = created_at.in_time_zone(resource.organization.time_zone)
  if frequency == :daily
    I18n.l(created_at_in_time_zone, format: :time_of_day)
  else
    I18n.l(created_at_in_time_zone, format: :decidim_short)
  end
end

#email_introObject



20
21
22
# File 'decidim-core/app/presenters/decidim/notification_to_mailer_presenter.rb', line 20

def email_intro
  event.email_intro if event.respond_to?(:email_intro)
end

#show_extended_information?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'decidim-core/app/presenters/decidim/notification_to_mailer_presenter.rb', line 33

def show_extended_information?
  EXTENDED_NOTIFICATIONS_CLASSES.include?(event_class)
end