Class: Decidim::NotificationPresenter

Inherits:
SimpleDelegator
  • Object
show all
Includes:
ActionView::Helpers::DateHelper
Defined in:
app/presenters/decidim/notification_presenter.rb

Overview

Decorator for notifications.

Instance Method Summary collapse

Instance Method Details

#created_at_in_wordsObject



12
13
14
15
16
17
18
19
# File 'app/presenters/decidim/notification_presenter.rb', line 12

def created_at_in_words
  if created_at.between?(1.month.ago, Time.current)
    I18n.t("decidim.user_conversations.index.time_ago", time: time_ago_in_words(created_at))
  else
    format = created_at.year == Time.current.year ? :ddmm : :ddmmyyyy
    I18n.l(created_at, format:)
  end
end

#display_resource_text?Boolean

Returns:

  • (Boolean)


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

def display_resource_text?
  event_class.constantize.included_modules.include?(Decidim::Comments::CommentEvent)
end